MyRapidi
MyRapidi

Search our Wiki

REST API Schedules Update Schedule to run now

If you want to update a schedule to run now, you can set the 'next_datetime' field to achive this. Please see below for both JSON and JSONAPI example.

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 PATCH
  -d "{\"next_datetime\": \"2017-08-15T14:30:00Z\"}"
  https://api.myrapidi.com/api/v2/service/[SERVICE ID]/schedules/19

The out-put for this example would be:

{
  "code":  "G_TEST22_NAV356001",
  "description": "Group  TEST22 NAV356001",
  "transfer":  "",
  "group": "TEST22",
  "interval":  33,
  "interval_unit": "Day",
  "status":  "Ok",
  "error_handling":  "Skip",
  "last_datetime": null,
  "next_datetime": "2017-08-15T14:30:00Z",
  "error_interval":  0,
  "error_interval_unit": "Hours",
  "notify_interval": 0,
  "notify_interval_unit":  "Hours",
  "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":  [
   {
     "code":  "NAV300",
     "value": "NAV356001"
   }
  ],
  "comments":  []
}

JSONAPI:

curl -H "Authorization: Bearer [API SECURITY TOKEN]"
  -H "Content-Type: application/vnd.api+json" 
  -H "Accept: application/vnd.api+json"
  -X PATCH
  -d "{\"data"\":{\"type\":\"schedules\",\"attributes\": {\"next_datetime\":\"2017-08-15T15:35:00Z\"}"}}"
  https://api.myrapidi.com/api/v2/service/[SERVICE ID]/schedules/19

The out-put for this example would be:

{
  "data":{
    "id":"19",
    "type":  "schedules",
    "attributes":{
      "code":  "G_TEST22_NAV356001",
      "description": "Group  TEST22 NAV356001",
      "transfer":  "",
      "group": "TEST22",
      "interval":  33,
      "interval_unit": "Day",
      "status":  "Ok",
      "error_handling":  "Skip",
      "last_datetime": null,
      "next_datetime": "2017-08-15T15:35:00Z",
      "error_interval":  0,
      "error_interval_unit": "Hours",
      "notify_interval": 0,
      "notify_interval_unit":  "Hours",
      "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":  [
          {
            "id":  "7",
            "type":  "schedule_tags"
          }
        ]
      },
      "comments":  {
        "data":  []
      }
    }
  },
  "included": [
    {
      "id":  "7",
      "type":  "schedule_tags",
      "attributes":  {
        "code":  "NAV300",
        "value": "NAV356001"
      }
    }
  ]
}