SemaphoreDocs
Search…
API

How to use Semaphore API

Login to Semaphore (password should be escaped, slashy\\pass instead of slashy\pass e.g.):
1
curl -v -c /tmp/semaphore-cookie -XPOST \
2
-H 'Content-Type: application/json' \
3
-H 'Accept: application/json' \
4
-d '{"auth": "YOUR_LOGIN", "password": "YOUR_PASSWORD"}' \
5
http://localhost:3000/api/auth/login
Copied!
Get user tokens:
1
curl -v -b /tmp/semaphore-cookie \
2
-H 'Content-Type: application/json' \
3
-H 'Accept: application/json' \
4
http://localhost:3000/api/user/tokens
Copied!
Generate a new token if user had no one and get tokens again:
1
curl -v -b /tmp/semaphore-cookie -XPOST \
2
-H 'Content-Type: application/json' \
3
-H 'Accept: application/json' \
4
http://localhost:3000/api/user/tokens
5
6
7
curl -v -b /tmp/semaphore-cookie \
8
-H 'Content-Type: application/json' \
9
-H 'Accept: application/json' \
10
http://localhost:3000/api/user/tokens
Copied!
Should be returned something like:
[{"id":"YOUR_ACCESS_TOKEN","created":"2017-03-11T13:13:13Z","expired":false,"user_id":1}]
Use this token for launching a task or anything else:
1
curl -v -XPOST \
2
-H 'Content-Type: application/json' \
3
-H 'Accept: application/json' \
4
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
5
-d '{"template_id": 1}' \
6
http://localhost:3000/api/project/1/tasks
Copied!

API documentation

Full API documentation is available in API reference.
Last modified 27d ago