In the article below you will find important information about the usage of the Testinvite’s API for fetching tasks. We will firstly explain structure and types of the request body, and then show some examples of calls in Postman and in different programming languages. Lastly we will describe the structure of the response body.
If you want to try API requests immediately you can check the Postman collection we have created for you. Please click here to download the Postman collection.
Request body for fetching tickets consists of 1 required property: "requester". Requester is an object containing properties related with authentication. Mainly you should include your organization's id and organization's private key in "auth" property of requester.
In the tree view below you can see request body and its types.
In the examples below, you can see a request for fetching tasks. The example on the left is created in POSTMAN, and the right one is created according to cURL. You can use these examples simply by using your organization's name, id, and private key.
To make a request for fetching tasks you should only fill 2 properties in the request object: "name", "auth". "name" is your organization's name and "auth" is the container object for 2 properties: "organizationId" and "privateKey". After having set values of these properties you can make the request.
Example body
{ "requester": { "name": "Yusuf's Company", "auth": { "organizationId": "zUH8oMYJ60As4HYP", "privateKey": "a8faef00-43c1-11ed-81bc-976010" } } }
cURL
curl --location --request POST 'http://localhost:5000/api/v1/fatih/fetch-tasks' \ --header 'Content-Type: application/json' \ --data-raw '{ "requester": { "name": "Yusuf'\''s Company", "auth": { "organizationId": "zUH8oMYJ60As4HYP48Zx", "privateKey": "76f75bd0-4315-11ed-98ad-1127beb80c0d" } } }'
Response body mainly consists of two parts: "kind" and "payload". Kind property takes value according to the response status. If there is no error it should be "zetok", if there is it will be "zeterror". As it contains all data about created tickets payload is the essential part of the response body.
In the payload object, you should see one "tasks" property that is an array containing objects. Each element of the array should consist of 2 properties: "taskId" and "title". "taskId" is the id of the task and "title" is the title of the task.
In the tree view below you can see response body and its types.
In the example below there is one response example for fetching task request. In the tasks array, there are 2 objects containing task id and task title. The length of the tasks array will be equal to task number of the organization that makes the request.
Response for fetching tasks
{ "kind": "zetok", "payload": { "tasks": [ { "taskId": "1ac4rJ6Ulbd6I59MBmi1", "title": "deneme task4" }, { "taskId": "4M5C4HKLxgxflIJhx9V6", "title": "deneme task2" }, . . . ] } }