Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Fiat Tux
Hat softwares
erco
Commits
67ebf444
Commit
67ebf444
authored
Jul 10, 2015
by
Luc Didry
Browse files
Fix responses code + API documentation
parent
f9785ce1
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
lib/Erco/Controller/API/Exabgp.pm
View file @
67ebf444
...
...
@@ -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
);
}
}
}
...
...
lib/Erco/Controller/API/Subnet.pm
View file @
67ebf444
...
...
@@ -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
,
...
...
public/api/api.md
View file @
67ebf444
...
...
@@ -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"
...
...
public/api/index.html
View file @
67ebf444
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment