Tasks

This endpoint can be used to create scheduled tasks for one or more advertisements.

Reference

GET /tasks/<userId>/[<portal>]/[<taskId>]

Retrieve tasks

POST /tasks/

Create a new task

PUT /tasks/

Update an existing task

DELETE /tasks/

Remove a task


General search parameters

field type description/constraints Req W U
useCache boolean Use API caching module No No No
page int Show page x from resultset (default: 1) No No No
itemsPerPage int Number of items per page
Minimum: 1 item
Maximum 100 items (default: 25)
No No No

Fields

field type description/constraints Req W U
taskId int The taskId. Field is required when updating and 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 No
Available options:
- marktplaats
- tweedehands
feature string The feature to perform. No Yes Yes
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,
  "fromCache": true,
  "totalItems": 1,
  "totalInSet": 1,
  "page": 1,
  "itemsPerPage": 25,
 "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 updating task

Request

PUT /rest/v1/tasks/ HTTP/2
{
 "taskId": 2965,
 "userId": 12311,
 "adId": [
   659939,
   661364
 ],
 "time": "12:16",
 "dayOfWeek": [
   "monday",
   "wednesday",
   "saturday"
 ],
 "portal": "marktplaats",
 "feature": "upcall",
 "enabled": true
}

Response

{
 "result": true,
 "errors": [],
 "data": [
   {
     "taskId": 2965,
     "userId": 12311,
     "adId": [
       659593,
       659939
     ],
     "time": "12:16",
     "dayOfWeek": [
       "monday",
       "wednesday",
       "saturday"
     ],
     "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
   }  
 ]
}