Tasks
This endpoint can be used to create scheduled tasks for one or more advertisements.
Reference
GET /tasks/<userId>/<portal>/
Retrieve tasks
POST /tasks/
Create or replace a task
DELETE /tasks/
Remove a task
Fields
field | type | description/constraints | Req | W | U |
---|---|---|---|---|---|
taskId | int | The taskIdField is required when removing tasks | Yes/No | No | No |
userId | int | The userId | Yes | Yes | No |
adId | array | A list of one or more adId's for which this task is created |
|||
When no adId's are specified, the task will be executed for all active advertisements on the specified portal. | No | Yes | Yes | ||
time | time | The time at which the scheduled task will be executed Format: hh:mm |
Yes | Yes | Yes |
dayOfWeek | array | List of days on which the scheduled task will be executed. | No | Yes | Yes |
Available options: | |||||
- monday | |||||
- tuesday | |||||
- wednesday | |||||
- thursday | |||||
- friday | |||||
- saturday | |||||
- sunday | |||||
When omitted: the task will be processed at the scheduled time set with field 'time' every 24 hours | |||||
portal | string | The portal for which this task is created. | Yes | Yes | Yes |
Available options: | |||||
- marktplaats | |||||
- tweedehands | |||||
feature | string | The feature to perform. | No | Yes | No |
Default: upcall | |||||
enabled | boolean | Is the task enabled | Yes | Yes | Yes |
Example retrieving tasks
Request
GET /rest/v1/tasks/12311/ HTTP/2
or
GET /rest/v1/tasks/?userId=12311 HTTP/2
Response
{
"result": true,
"errors": [],
"data": [
{
"taskId": 2965,
"userId": 12311,
"adId": [
659593,
659939
],
"time": "12:15",
"dayOfWeek": [
"monday",
"wednesday",
"friday"
],
"portal": "marktplaats",
"feature": "upcall",
"enabled": false
},
]
}
Example creating task
Request
POST /rest/v1/tasks/ HTTP/2
{
"userId": 12311,
"adId": [
659939,
661364
],
"time": "12:16",
"dayOfWeek": [
"monday",
"wednesday",
"friday"
],
"portal": "marktplaats",
"feature": "upcall",
"enabled": true
}
Response
{
"result": true,
"errors": [],
"data": [
{
"taskId": 2965,
"userId": 12311,
"adId": [
659593,
659939
],
"time": "12:15",
"dayOfWeek": [
"monday",
"wednesday",
"friday"
],
"portal": "marktplaats",
"feature": "upcall",
"enabled": false
},
{
"taskId": 2974,
"userId": 12311,
"adId": [
659939,
661364
],
"time": "12:16",
"dayOfWeek": [
"monday",
"wednesday",
"friday"
],
"portal": "marktplaats",
"feature": "upcall",
"enabled": false
}
]
}
Example removing task
Request
DELETE /rest/v1/tasks/ HTTP/2
{
"taskId": 2974,
"userId": 12311,
"portal": "marktplaats"
}
Response
{
"result": true,
"errors": [],
"data": [
{
"taskId": 2965,
"userId": 12311,
"adId": [
659593,
659939
],
"time": "12:15",
"dayOfWeek": [
"monday",
"wednesday",
"friday"
],
"portal": "marktplaats",
"feature": "upcall",
"enabled": false
}
]
}