Codebox is based on a very simple REST API which allow clients to create boxes from any applications. You can also use a wrapper for the API in Python, Javascript or Ruby.
All the API methods use the header Authorization for authenticate the user.
$ curl -X POST https://api.codebox.io/api/boxes \
-H "Authorization: <your api token>" \
-d "name=Test" \
-d "type=type1" \
-d "stack=node"
Optional paramters are:
- description: (string) default is empty
- git: (string) default is empty
- public: (boolean) default is false
$ curl -X GET https://api.codebox.io/api/boxes \
-H "Authorization: <your api token>"
Get the list of collaborators emails:
$ curl -X GET https://api.codebox.io/api/box/<box>/collaborators \
-H "Authorization: <your api token>"
Add a collaborator by email:
$ curl -X POST https://api.codebox.io/api/box/<box>/collaborators \
-H "Authorization: <your api token>" \
-d "[email protected]"
Remove a collaborator by email:
$ curl -X DELETE https://api.codebox.io/api/box/<box>/collaborators \
-H "Authorization: <your api token>" \
-d "[email protected]"
Get the information about a box:
$ curl -X GET https://api.codebox.io/api/box/<box> \
-H "Authorization: <your api token>"
Remove a box:
$ curl -X DELETE https://api.codebox.io/api/box/<box> \
-H "Authorization: <your api token>"
List events for a boxes:
$ curl -X GET https://api.codebox.io/api/box/<box>/events \
-H "Authorization: <your api token>"
Get box activity:
$ curl -X GET https://api.codebox.io/api/box/<box>/activity \
-H "Authorization: <your api token>"
Create a client:
var Codebox = require("codebox-io").Client;
var client = new Codebox({
'token': "<api token>"
});
Create a box:
client.create({
'type': 'type1',
'name': 'My Node Box',
'stack': 'python'
}).then(function(box) {
console.log(box.id," : ", box.name)
});
List boxes:
client.boxes().then(function(boxes) {
boxes.forEach(function(box) {
console.log(box.id," : ", box.name)
})
});
Get a box by its id:
client.box("7546736a-621d-434f-9c10-ad7cd0773a06").then(function(box) {
console.log(box.id," : ", box.name)
});