The request parameters can be sent in 2 different ways:
1. x-www-form-urlencoded
Example:
POST /devettpttlmlive/v4/messages/create/ HTTP/1.1
Host: api-dev.timetac.com
Authorization: Bearer 7053xxxxxxxxxxxxxxxxxxxxxxxx066c
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
Postman-Token: d937270f-6c60-2f15-db73-bb73cce43126
sender_id=1&message=Hello+Max%2C+I+will+be+late+today+so+please+meet+me+at+10%3A00.+Thank+you×tamp=2016-09-27+07%3A00%3A00
Example (nested entities): timeTrackings - creates 1 timeTracking and 2 checkpointTrackings
POST /devettpttlmlive/v4/messages/create/ HTTP/1.1
Host: api-dev.timetac.com
Authorization: Bearer 7053xxxxxxxxxxxxxxxxxxxxxxxx066c
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
Postman-Token: d937270f-6c60-2f15-db73-bb73cce43126
start_time=2017-06-13+13%3A28%3A36&task_id=4&user_id=1&start_time_timezone=Europe%2FVienna&end_time=2017-06-22+18%3A05%3A00&end_time_timezone=Europe%2FVienna&nestedEntities=%7B%22checkpointTrackings%22%3A%5B%7B%22checkpoint_id%22%3A%2210%22%2C%22timestamp%22%3A%222017-06-13+13%3A28%3A36%22%2C%22timezone%22%3A%224%22%7D%2C%7B%22checkpoint_id%22%3A%2211%22%2C%22timestamp%22%3A%222017-06-13+13%3A35%3A36%22%2C%22timezone%22%3A%224%22%7D%5D%7D
2. JSON (Batch request)
Batch requests are very useful because they provide you with possibility to execute multiple entities with a single API call.
Batch requests are limited to 100 items per request and this is a hard limit for every user account.
The current batch limit is there because of both performance and security reasons, and API solutions should be developed with this limit in mind.
In general, if you are using batch request you should:
- Implement the "slicer" from your side which will separate your requests to multiples of 100.
- Implement proper error handling mechanisms and models which can examine results of bulk executions.
- Increase response time waiting (timeout config) because batch requests can be slower, depending on what is inside of the batch.
Example:
POST /devettpttlmlive/v4/messages/create/ HTTP/1.1
Host: api-dev.timetac.com
Authorization: Bearer 7053xxxxxxxxxxxxxxxxxxxxxxxx066c
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: f10b6a07-d261-4edc-c79f-f85819fe42a5
[
{
"message": "Lorem Ipsum",
"sender_id": 1,
"receiver_type": "USER",
"receiver_id": 10
},
{
"message": "Dolor Sit Amet",
"sender_id": 1,
"receiver_type": "USER",
"receiver_id": 11
},
{
"message": "Consectetur Adipiscing Elit",
"sender_id": 1,
"receiver_type": "USER",
"receiver_id": 12
}
]
Example (nested entities): timeTrackings - creates 1 timeTracking and 2 checkpointTrackings:
POST /devettpttlmlive/v4/timeTrackings/create/ HTTP/1.1
Host: api-dev.timetac.com
Authorization: Bearer 7053xxxxxxxxxxxxxxxxxxxxxxxx066c
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: f10b6a07-d261-4edc-c79f-f85819fe42a5
[
{
"user_id":10,
"task_id":4,
"start_time":"2024-01-13 08:00:00",
"end_time":"2024-01-13 09:00:00",
"start_time_timezone":"Europe/Vienna",
"end_time_timezone":"Europe/Vienna",
"nestedEntities":{
"checkpointTrackings":[
{
"checkpoint_id":1,
"timestamp":"2024-01-13 08:20:00",
"timezone":"Europe/Vienna"
},
{
"checkpoint_id":1,
"timestamp":"2024-01-13 08:40:00",
"timezone":"Europe/Vienna"
}
]
}
}
]
Example projects - creates 1 project with 2 tasks + 1 subproject with 2 tasks + 1 subproject:
POST /devettpttlmlive/v4/projects/create/ HTTP/1.1
Host: api-dev.timetac.com
Authorization: Bearer 7053xxxxxxxxxxxxxxxxxxxxxxxx066c
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: f10b6a07-d261-4edc-c79f-f85819fe42a5
[
{
"mother_id":3,
"sort_order":50,
"name":"Marketing New Project",
"nestedEntities":{
"tasks":[
{
"sort_order":"10",
"name":"1 of 2 Tasks"
},
{
"sort_order":"11",
"name":"2 of 2 Tasks"
}
],
"projects":[
{
"sort_order":"10",
"name":"1 Project with 2 Nested tasks here",
"nestedEntities":{
"projects":[
{
"sort_order":"10",
"name":"1 of 2 Project Nested"
},
{
"sort_order":"11",
"name":"2 of 2 Project Nested"
}
]
}
},
{
"sort_order":"10",
"name":"1 Project"
}
]
}
}
]