Intro
Internal users can communicate with Ctfreak using a RESTful JSON API.
For example to launch a task on the demo server, we start by getting a token for the demo user account (username: demo
/ password: demo
):
- HTTP POST: https://demo.ctfreak.com/api/v1/token?grant_type=password&username=demo&password=demo
- Response:
{
"access_token": "N4tbVp4iAGtJ-_HsfNjuRuyG79wL7xLsz1TpNLxi7B0=",
"token_type": "Bearer",
"userId": "01G9DEW9AAGQNEVZWF7QZ98WNA"
}
And we use this token to launch a task (get the taskId displayed in the web UI)
- HTTP POST: https://demo.ctfreak.com/api/v1/executions
- Header:
Content-Type: application/json Authorization: Bearer N4tbVp4iAGtJ-_HsfNjuRuyG79wL7xLsz1TpNLxi7B0=
- Body:
{ "taskId": "01G9SAGYJM6544WZR8P3W7XB5Q" }