Create a `config.json`` file and fill in the required info:
Create a configs
folder in which you can create a config per api, example ./configs/pcm-v4-api.json
{
"name": "example-api-v1",
"base_url": "https://api.example.com/v1",
"request_jwt": {
"endpoint": ""
},
"default_options": {
"check_data": true,
"check_status": "success",
"check_status_code": 200,
"check_checksum": true, // check if result contains property checksum or data.checksum and resends the request with provided checksum in querystring, the result should be 204
"authorization_header": ""
},
"controllers": {
"data/attributes": {
"check_length": 200,
"check_execution_time": 100,
"check_object_name": "attributes",
"check_object_properties": [
"id",
"attribute",
"group",
"name",
"name.nl",
"name.fr"
]
}
}
}
By default we expect the followinf results from the API:
{
"status": "success",
"code": 200,
"data": {
// properties
"length": 1, // amount of items in first property (optional)
"checksum": "controlchecksum" // (optional)
},
"executionTime": 13.83924729432 // execution time of backend code in miliseconds (optional)
}
data
can also be aan array, in which case the length will be based on the array length of data.
Other response formats are also supported but will have to be declared in full, example in config (not yet implemented):
{
"name": ...,
"controllers": {
"controller-name": {
...,
"check_response_body": {
"properties": {
"name_of_property": {
"type": "string",
"expect_exact_value": "value_to_expect"
},
"name_of_optional_property": {
"type": "number",
"optional": true,
"expect_min_value": 10,
"expect_max_value": 100
}
}
}
}
}
}
*/15 * * * * docker run --rm --name api-tester --mount type=bind,src=/home/jamievangeysel/api-tester/config.json,dst=/usr/src/app/config.json --mount type=bind,src=/home/jamievangeysel/api-tester/configs,dst=/usr/src/app/configs groupclaes/api-tests-betteruptime:latest