# Schedules

Schedule pass updates for future delivery.


## Delete schedule {#deleteschedule}

Deletes the specified schedule.

[Jump to examples ↓](#deleteschedule-examples)

### `DELETE /schedules/{projectId}/{scheduleId}`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wsch

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `projectId` | `string` | Required | The project ID. |
| `scheduleId` | `string` | Required | The schedule ID. This is appended to the end of the `url` in the response for schedule operations. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Responses**

**`204`** A deleted schedule returns no content.

**Examples**

*Example request*

```http
DELETE /v1/schedules/12345/3b13666df-e5b3-4e42-8919-f8d63bd7ce2a HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Response*

```http
HTTP/1.1 204 No Content

```

---

## Get schedule {#getschedule}

Return a single project's schedule.

[Jump to examples ↓](#getschedule-examples)

### `GET /schedules/{projectId}/{scheduleId}`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wsch

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `projectId` | `string` | Required | The project ID. |
| `scheduleId` | `string` | Required | The schedule ID. This is appended to the end of the `url` in the response for schedule operations. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Responses**

**`200`** Returns a single schedule object.

Response body:

**Content-Type:** `application/json`

[Schedule update object]({{< ref "/developer/rest-api/wallet/schemas/others/" >}}#scheduleupdateobject)

**Examples**

*Example request*

```http
GET /v1/schedules/12345/2d69320c-3c91-5241-fac4-248269eed109 HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "name": "New Offer Update",
  "schedule": {
     "scheduled_time": "2017-04-10T18:45:00"
  },
  "update": {
     "audience": {
        "tag": "TZ_ET"
     },
     "pass": {
        "fields": {
           "primary1": {
              "value": "$20 Off"
           },
           "secondary1": {
              "value": "Mega Offer"
           }
        }
     }
  }
}

```

---

## List schedules {#listschedules}

Get a list of all schedules that have not yet occurred for the project.

[Jump to examples ↓](#listschedules-examples)

### `GET /schedules/{projectId}`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wsch

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `projectId` | `string` | Required | The project ID. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Responses**

**`200`** Returns a list of schedules, ordered scheduled_time closest to the present.

Response body:

**Content-Type:** `application/json`

- **`count`** `integer`

  The number of schedules on the page.

- **`next_page`** `string`

  The URL of the next page in the result set.

  Format: `url`

- **`ok`** `boolean`

  If true, the operation completed successfully.

- **`schedules`** `array` <[Schedule update object]({{< ref "/developer/rest-api/wallet/schemas/others/" >}}#scheduleupdateobject)>

  The list of upcoming schedules.

- **`total_count`** `integer`

  The total number of schedules.

**Examples**

*Example request*

```http
GET /v1/schedules/12345 HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
   "count": 2,
   "next_page": "https://wallet-api.urbanairship.com/v1/schedules/12345?start=5c69320c-3e91-5241-fad3-248269eed104&limit=2&order=asc",
   "ok": true,
   "schedules": [
      {
         "schedule": {
            "scheduled_time": "2017-04-10T18:45:00"
         },
         "update": {
            "audience": {
               "tag": "TZ_ET"
            },
            "pass": {
               "fields": {
                  "primary1": {
                     "value": "$20 Off"
                  },
                  "secondary1": {
                     "value": "Mega Offer"
                  }
               }
            }
         },
         "url": "http://wallet-api.urbanairship/v1/schedules/12345/2d69320c-3c91-5241-fac4-248269eed109"
      },
      {
         "schedule": {},
         "update": {},
         "url": "http://wallet-api.urbanairship/v1/schedules/12345/2d69320c-3c91-5241-fac4-248269eed10A"
      }
   ],
   "total_count": 4
}

```

---

## Schedule an update or push notification {#scheduleupdate}

Schedule an update to a project or schedule a notification to a project.

[Jump to examples ↓](#scheduleupdate-examples)

### `POST /schedules/{projectId}`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wsch

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `projectId` | `string` | Required | The project ID. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Request body**

The schedule update object to schedule an update or the schedule notification object to schedule a notification.

**Content-Type:** `application/json`

**One of:**

- [Schedule update object]({{< ref "/developer/rest-api/wallet/schemas/others/" >}}#scheduleupdateobject)

  Specifies updates to passes or adaptive links at a particular date and time.

  - **`name`** `string`

    A name for the schedule.

  - **`notify`** `object`

    The notification you want to send to an `audience` or `pass`, generated from a `template` within the project. Cannot be used with the update object present as well.

    **OBJECT PROPERTIES**

    - **`audience`** `object` <[Audience selector]({{< ref "/developer/rest-api/wallet/schemas/audience-selection/" >}}#audienceselector)>

      Determines the passes you want to target.

    - **`pass`** `object`
      **OBJECT PROPERTIES**

      - **`notification`** `object`

        An object for sending a custom pass notification message.

        **OBJECT PROPERTIES**

        - **`endTime`** `string` **GOOGLE ONLY**

          The [date-time](/docs/developer/rest-api/wallet/introduction/#datetime-format) string indicating when the message should disappear. Defaults to one hour in the future.

          Format: `date-time`

        - **`label`** `string`

          Optional header for the message.

        - **`startTime`** `string` **GOOGLE ONLY**

          The [date-time](/docs/developer/rest-api/wallet/introduction/#datetime-format) string indicating when the message should appear. Defaults to the current time.

          Format: `date-time`

        - **`value`** `string` **REQUIRED**

          The body of the notification message.

  - **`schedule`** `object`
    **OBJECT PROPERTIES**

    - **`scheduled_time`** `string`

      The ISO 8601 inclusive date, optionally including an offset, e.g., 2007-03-01T13:00:00+08:00. The value will be converted and stored as UTC.

      Format: `date-time`

    - **`url`** `string`

      A URL to get the schedule object.

      Format: `url`

      Read only: true


**Responses**

**`200`** Returns the schedule request along with identifiers for the operation and the schedule itself.

Response body:

**Content-Type:** `application/json`

- **`ok`** `boolean`

  If true, the operation completed successfully.

- **`operation_id`** `string`

  Identifies the operation for troubleshooting and logging.

  Format: `uuid`

- **`schedule_urls`** `array[string]`

  URLs for the schedules created by the operation. Items in the array are ordered just as they were in the request.

- **`schedules`** `array` <[Schedule update object]({{< ref "/developer/rest-api/wallet/schemas/others/" >}}#scheduleupdateobject)>
**Examples**

*Example request for update*

```http
POST /v1/schedules/12345 HTTP/1.1
Authorization: Basic <Base64 key>
Content-Type: application/json
Api-Revision: 1.2

{
   "name": "New Offer Update",
   "schedule": {
      "scheduled_time": "2017-04-10T18:45:00"
   },
   "update": {
      "audience": {
         "tag": "TZ_ET"
      },
      "pass": {
         "fields": {
            "primary1": {
               "value": "$20 Off"
            },
            "secondary1": {
               "value": "Mega Offer"
            }
         }
      }
   }
}

```

*Response for update*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "ok": true,
  "operation_id": "efb18e92-9a60-6689-45c2-82fedab36399",
  "schedule_urls": [
     "https://wallet-api.urbanairship/v1/schedules/12345/2d69320c-3c91-5241-fac4-248269eed109"
  ],
  "schedules": [
     {
        "url": "https://wallet-api.urbanairship/v1/schedules/12345/2d69320c-3c91-5241-fac4-248269eed109",
        "ticket": "https://wallet-api.urbanairship/v1/ticket/6789",
        "name": "New Offer Update",
        "schedule": {
           "scheduled_time": "2017-04-10T18:45:00"
        },
        "update": {
           "audience": {
              "tag": "TZ_ET"
           },
           "pass": {
              "fields": {
                 "secondary1": {
                    "value": "Mega Offer"
                 },
                 "primary1": {
                    "value": "$20 Off"
                 }
              }
           }
        }
     }
  ]
}

```

*Example request for notification*

```http
POST /v1/schedules/12345 HTTP/1.1
Authorization: Basic <Base64 key>
Content-Type: application/json
Api-Revision: 1.2

{
   "name": "New Offer Update",
   "schedule": {
      "scheduled_time": "2017-04-10T18:45:00"
   },
   "notify": {
      "audience": {
         "tag": "TZ_ET"
      },
      "pass": {
         "notification": {
            "label": "Last Notification",
            "value": "20% off any one regular priced item"
         }
      }
   }
}

```

*Response for notification*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "ok": true,
  "operation_id": "efb18e92-9a60-6689-45c2-82fedab36399",
  "schedule_urls": [
     "https://wallet-api.urbanairship/v1/schedules/12345/2d69320c-3c91-5241-fac4-248269eed109"
  ],
  "schedules": [
     {
        "url": "https://wallet-api.urbanairship/v1/schedules/12345/2d69320c-3c91-5241-fac4-248269eed109",
        "ticket": "https://wallet-api.urbanairship/v1/ticket/6789",
        "name": "New Offer Update",
        "schedule": {
           "scheduled_time": "2017-04-10T18:45:00"
        },
        "notify": {
           "audience": {
              "tag": "TZ_ET"
           },
           "pass": {
              "notification": {
                 "label": "Last Notification",
                 "value": "20% off any one regular priced item"
              }
           }
        }
     }
  ]
}

```

---

## Update schedule {#updateschedule}

Update a schedule. The payload to update a schedule is identical to the request to create a schedule.

[Jump to examples ↓](#updateschedule-examples)

### `PUT /schedules/{projectId}/{scheduleId}`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wsch

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `projectId` | `string` | Required | The project ID. |
| `scheduleId` | `string` | Required | The schedule ID. This is appended to the end of the `url` in the response for schedule operations. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Request body**

**Content-Type:** `application/json`

[Schedule update object]({{< ref "/developer/rest-api/wallet/schemas/others/" >}}#scheduleupdateobject)

**Responses**

**`200`** Returns the updated schedule object.

Response body:

**Content-Type:** `application/json`

- **`ok`** `boolean`

  If true, the operation completed successfully.

- **`operation_id`** `string`

  Identifies the operation for troubleshooting and logging.

  Format: `uuid`

- **`schedule_urls`** `array[string]`

  URL for the updated schedule.

- **`schedules`** `array` <[Schedule update object]({{< ref "/developer/rest-api/wallet/schemas/others/" >}}#scheduleupdateobject)>
**Examples**

*Example request*

```http
PUT /v1/schedules/12345/3b13666df-e5b3-4e42-8919-f8d63bd7ce2a HTTP/1.1
Authorization: Basic <Base64 key>
Content-Type: application/json
Api-Revision: 1.2

{
   "name": "New Offer Update",
   "schedule": {
      "scheduled_time": "2017-04-11T18:45:00"
   },
   "update": {
      "audience": {
         "tag": "TZ_ET"
      },
      "pass": {
         "fields": {
            "primary1": {
               "value": "$20 Off"
            },
            "secondary1": {
               "value": "Mega Offer"
            }
         }
      }
   }
}

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "ok": true,
  "operation_id": "efb18e92-9a60-6689-45c2-82fedab36490",
  "schedule_urls": [
     "https://wallet-api.urbanairship/v1/schedules/12345/2d69320c-3c91-5241-fac4-248269eed109"
  ],
  "schedules": [
     {
        "url": "https://wallet-api.urbanairship/v1/schedules/12345/2d69320c-3c91-5241-fac4-248269eed109",
        "name": "New Offer Update",
        "schedule": {
           "scheduled_time": "2017-04-11T18:45:00"
        },
        "update": {
           "audience": {
              "tag": "TZ_ET"
           },
           "pass": {
              "fields": {
                 "secondary1": {
                    "value": "Mega Offer"
                 },
                 "primary1": {
                    "value": "$20 Off"
                 }
              }
           }
        }
     }
  ]
}

```

---

