Intro
Internal users can communicate with Ctfreak using a RESTful JSON API.
For example to launch a task on the demo server, you 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 you 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", }
If you launch a parameterizable task, each parameter is initialized with its default value, but you can override it.
For example, for a task with the parameters:
COUNTRY_CODE
of type selectorCLEAN
of type checkboxMAX_RETRY
of type integerSTART_DATE
of type date
You can attempt to run the following query:
HTTP POST: https://demo.ctfreak.com/api/v1/executions
Header:
Content-Type: application/json Authorization: Bearer N4tbVp4iAGtJ-_HsfNjuRuyG79wL7xLsz1TpNLxi7B0=
Body:
{ "taskId": "01G9SAGYJM6544WZR8P3W7XB5Q", "parameterMap": { "COUNTRY_CODE": "US", "CLEAN": true, "MAX_RETRY": 5, "START_DATE": "2024-01-25" } }