Commit 67ebf444 authored by Luc Didry's avatar Luc Didry
Browse files

Fix responses code + API documentation

parent f9785ce1
......@@ -93,7 +93,10 @@ sub command {
});
} else {
$c->app->log->info(sprintf('IP %s tried to launch the following unauthorized command: %s', $c->remote_addr, $a));
$msg->{msg} = $c->l('You tried to launch an unauthorized command. Contact an administrator.');
$msg->{msg} = $c->l('You tried to launch an unauthorized command. Contact an administrator.');
$c->render(
json => $msg
);
}
}
}
......
......@@ -67,7 +67,6 @@ sub post {
}
}
$c->res->code(($success) ? 200 : 400);
$c->render(
json => {
success => ($success) ? true : false,
......@@ -119,7 +118,6 @@ sub put {
}
}
$c->res->code(($success) ? 200 : 400);
$c->render(
json => {
success => ($success) ? true : false,
......@@ -143,7 +141,6 @@ sub delete {
$msg = $c->l('Unable to found the network with id = [_1]', $id);
}
$c->res->code(($success) ? 200 : 400);
$c->render(
json => {
success => ($success) ? true : false,
......
......@@ -72,6 +72,7 @@ Announce a new subnet.
+ Response 200 (application/json)
# Success:
{
"success":true,
"msg":{
......@@ -90,8 +91,7 @@ Announce a new subnet.
}
}
+ Response 400 (application/json)
# Failure:
{
"success":false,
"msg":"The reason why it failed"
......@@ -103,10 +103,11 @@ Modified an announced subnet.
+ Request (application/x-www-form-urlencoded)
id=3cidr=198.51.100.1/32&next_hop=192.0.2.42&communities[]=64496:42&communities[]=64511:123
id=3&cidr=198.51.100.1/32&next_hop=192.0.2.42&communities[]=64496:42&communities[]=64511:123
+ Response 200 (application/json)
# Success:
{
"success":true,
"msg":{
......@@ -125,8 +126,7 @@ Modified an announced subnet.
}
}
+ Response 400 (application/json)
# Failure:
{
"success":false,
"msg":"The reason why it failed"
......@@ -142,13 +142,13 @@ Stop to announce a subnet.
+ Response 200 (application/json)
# Success:
{
"success":true,
"msg":"Network successfully deleted."
}
+ Response 400 (application/json)
# Failure:
{
"success":false,
"msg":"The reason why it failed"
......@@ -176,11 +176,13 @@ Execute a command on Exabgp.
+ Response 200 (application/json)
# Success:
{
"success":true,
"msg":"Exabgp has been successfully reloaded."
}
# Failure:
{
"success":false,
"msg":"The reason why it failed"
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment