If you want to create a new schedule you need to set either the transfer code or group code.
In the example below we have set a group code and the interval to run every 3 hours.
NOTE: Remember to substitute the token (after Bearer) and the service id (the [SERVICE ID] below) to your own token and service id.
JSON:
curl
-H "Authorization: Bearer [API SECURITY TOKEN]"
-H "Content-Type: application/json"
-H "Accept: application/json"
-X POST
-d "{\"group\":\"NAV365\",\"interval\":3, \"interval_unit\":\"Hours\"} }}"
http://staging.myrapidi.com/api/v2/service/[SERVICE ID]/schedules
The out-put for this example would be:
{
"code":"G_NAV365",
"description": "Group NAV365",
"transfer": null,
"group": "NAV365",
"interval": 3,
"interval_unit": "Hours",
"status": "Stopped",
"error_handling": null,
"last_datetime": null,
"next_datetime": null,
"error_interval": null,
"error_interval_unit": null,
"notify_interval": null,
"notify_interval_unit": null,
"notify_datetime": null,
"start_time": "00:00:00Z",
"end_time": "00:00:00Z",
"monday": true,
"tuesday": true,
"wednesday": true,
"thursday": true,
"friday": true,
"saturday": true,
"sunday": true,
"tags": [],
"comments": []
}
JSONAPI:
curl
-H "Authorization: Bearer [API SECURITY TOKEN]"
-H "Content-Type: application/vnd.api+json"
-H "Accept: application/vnd.api+json"
-X POST
-d "{\"data"\":{\"type\":\"schedules\",\"attributes\": {\"group\":\"NAV365\", \"interval\":3, \"interval_unit\":\"Hours\"} }}"
https://api.myrapidi.com/api/v2/service/[SERVICE ID]/schedules
The out-put for this example would be:
{
"data":{
"id":"51",
"type": "schedules",
"attributes":{
"code": "G_NAV365",
"description": "Group NAV365",
"transfer": null,
"group": "NAV365",
"interval": 3,
"interval_unit": "Hours",
"status": "Stopped",
"error_handling": null,
"last_datetime": null,
"next_datetime": null,
"error_interval": null,
"error_interval_unit": null,
"notify_interval": null,
"notify_interval_unit": null,
"notify_datetime": null,
"start_time": "00:00:00Z",
"end_time": "00:00:00Z",
"monday": true,
"tuesday": true,
"wednesday": true,
"thursday": true,
"friday": true,
"saturday": true,
"sunday": true
},
"relationships": {
"tags": {
"data": []
},
"comments": {
"data": []
}
}
}
}