Schedules an API call to be made at one or more points in time in the future depending on the format of the schedule parameter provided.

The metadata payload is an arbitrary PostageApp send_message request.

Request Structure

{
  "api_key" : "__PROJECT_API__KEY__",
  "uid": "__UID__",
  "schedule": "in 5 hours",
  "metadata": {
    "arguments": {
      "recipients": "test@example.com",
      "headers": {
        "from": "test@example.com",
        "subject": "Example Scheduled Email"
      },
      "content": {
        "text/plain": "This email was sent automatically."
      },
      "attachments": {
        "test.pdf": {
          "content_type": "application/octet-stream",
          "content": {
            "$ref": "http://example.com/resources/example.pdf", 
            "$type": "application/octet-stream",
            "$encode": "base64"
          }
        }
      }
    }
  }
}

Response 200 OK

When an event is scheduled succesfully the following response is sent:

{
  "response": {
    "status": "ok",
    "uid": "__UID__"
  },
  "data": {
    "uid": "__UID__",
    "status": "activated",
    "schedule": "every 2 mins",
    "event_type": "repeatable",
    "scheduled_at": "2018-12-18T19:22:00+00:00",
    "metadata": "..."
  }
}

Response 404 Not Found

If the UID cannot be found for the given project the following is returned:

{
  "response": {
    "status": "not_found",
    "uid":"__UID__",
    "message": "Can not find scheduled event from the given UID"
  }
}