Throughout the Trak Software API documentation, we include code examples so you know how to format your requests, and what kind of data to expect in return.
We use curl to show all requests. For example, the following code snippet shows a POST request to the /accounts
endpoint:
curl --request POST \
--url 'https://example.trak.io/api/v1/accounts' \
--header 'Authentication: Bearer <api_key>' \
--header 'content-type: application/json' \
--data '{"name":"Example Account","status_id": 1, "notifications":true}'
To show example responses, we include a JSON object in pretty-print format. For example, here’s a response to a GET request to the accounts endpoint joined with the account statu and user resources:
{
"success": true,
"message": null,
"data": {
"current_page": 1,
"data": [
{
"account_id": 1,
"site_id": 1,
"user_id": 1,
"status_id": 1,
"name": "Foo Bar",
"notifications": 1,
"logo": null,
"created_at": "2018-12-07 19:53:20",
"updated_at": "2019-01-07 19:12:02",
"status_name": "Non-Collaborative",
"status": {
"status_id": 1,
"site_id": 1,
"user_id": 1,
"name": "Collaborative",
"active": 1,
"collaborative": 1,
"created_at": "2019-02-09 01:48:37",
"updated_at": "2019-02-09 01:48:37"
},
"users": [
{
"user_id": 1,
"site_id": 1,
"group_id": 1,
"first": "Trak",
"last": "Admin",
"email": "[email protected]",
"avatar": null,
"terms": 0,
"active": 1,
"editor": 1,
"created_at": "2018-12-03 20:33:01",
"updated_at": "2019-02-13 16:54:18",
"login_at": "2019-02-13 16:54:18",
"pivot": {
"account_id": 1,
"user_id": 1,
"created_at": "2018-12-07 19:53:25",
"updated_at": "2018-12-07 19:53:25"
}
},
...
]
},
...
],
"first_page_url": "https://example.trak.io/api/v1/accounts?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "https://example.trak.io/api/v1/accounts?page=1",
"next_page_url": null,
"path": "https://example.trak.io/api/v1/accounts",
"per_page": 50,
"prev_page_url": null,
"to": 14,
"total": 14
}
}