# Schedules Controller Resource

The API allows you to list, view, edit and create schedules.

### GET /schedules

Returns list of schedules filtered by specified query parameters.

Request Parameters
name | type | description | constraints | multivalued
--- | --- | --- | --- | ---
direction | query |  |  | no
filter | query |  |  | no
guids | query |  |  | yes
nameLike | query |  |  | no
orderBy | query |  |  | no
page | query |  |  | no
project-uuid | query |  |  | no
protected-entity | query |  |  | no
rules | query |  |  | yes
size | query |  |  | no
type | query |  | "APP_BACKUP" or "CLOUD_BACKUP" or "OS_BACKUP" or "STORAGE_BACKUP" or "STORAGE_SNAPSHOT" or "VM_BACKUP" or "VM_RESTORE" or "VM_SNAPSHOT" | no

Response Body
media type | data type | description
--- | --- | ---
application/json | array of ScheduleListRecord (JSON) | list of schedules filtered by specified query parameters

#### Example

##### Request

    GET /schedules
    Content-Type: */*
    Accept: application/json

    ...

##### Response

    HTTP/1.1 200 OK
    Content-Type: application/json

    [ {
      "guid" : "f8f73bf9-2445-4bce-a7dd-753be3b40a67",
      "daysOfWeek" : [ {
        "name" : "ENUM_NAME",
        "description" : "Enum description"
      }, {
        "name" : "...",
        "description" : "..."
      } ],
      "backupType" : {
        "name" : "ENUM_NAME",
        "description" : "Enum description"
      },
      "lastRun" : 1451649601000
    } ]

### POST /schedules

Create a schedule.

Request Parameters
name | type | description
--- | --- | ---
project-uuid | query |

Request Body
media type | data type | description
--- | --- | ---
application/json | ScheduleRequest (JSON) | specify data for new schedule

Response Body
media type | data type | description
--- | --- | ---
application/json | ScheduleDetails (JSON) | details of newly created schedule

#### Example

##### Request

    POST /schedules
    Content-Type: application/json
    Accept: application/json

    {
      "daysOfWeek" : [ {
        "name" : "ENUM_NAME",
        "description" : "Enum description"
      }, {
        "name" : "...",
        "description" : "..."
      } ],
      "backupType" : {
        "name" : "ENUM_NAME",
        "description" : "Enum description"
      }
    }

##### Response

    HTTP/1.1 201 Created
    Content-Type: application/json

    {
      "guid" : "f8f73bf9-2445-4bce-a7dd-753be3b40a67"
    }

### POST /schedules/details

Request Body
media type | data type
--- | ---
application/json | ScheduleListPostQueryParameters (JSON)

Response Body
media type | data type | description
--- | --- | ---
application/json | array of ScheduleListRecord (JSON) |

#### Example

##### Request

    POST /schedules/details
    Content-Type: application/json
    Accept: application/json

    {
      "direction" : "...",
      "filterOrNameLike" : "...",
      "filter" : "...",
      "size" : "...",
      "orderBy" : "...",
      "orderRequestCorrect" : true,
      "nameLike" : "...",
      "guids" : [ "...", "..." ],
      "page" : "..."
    }

##### Response

    HTTP/1.1 201 Created
    Content-Type: application/json

    [ {
      "guid" : "f8f73bf9-2445-4bce-a7dd-753be3b40a67",
      "daysOfWeek" : [ {
        "name" : "ENUM_NAME",
        "description" : "Enum description"
      }, {
        "name" : "...",
        "description" : "..."
      } ],
      "backupType" : {
        "name" : "ENUM_NAME",
        "description" : "Enum description"
      },
      "lastRun" : 1451649601000
    } ]

### DELETE /schedules/{guid}

Remove schedule.

Request Parameters
name | type | description
--- | --- | ---
guid | path | specify local unique identifier for schedule (use by vProtect)
project-uuid | query |

#### Example

##### Request

    DELETE /schedules/{guid}
    Content-Type: */*

    ...

##### Response

    HTTP/1.1 204 No Content

### GET /schedules/{guid}

Get a single schedule.

Request Parameters
name | type | description
--- | --- | ---
guid | path | specify local unique identifier for schedule (use by vProtect)

Response Body
media type | data type | description
--- | --- | ---
application/json | ScheduleDetails (JSON) | a single schedule details

#### Example

##### Request

    GET /schedules/{guid}
    Content-Type: */*
    Accept: application/json

    ...

##### Response

    HTTP/1.1 200 OK
    Content-Type: application/json

    {
      "guid" : "f8f73bf9-2445-4bce-a7dd-753be3b40a67"
    }

### PUT /schedules/{guid}

Change schedule details.

Request Parameters
name | type | description
--- | --- | ---
guid | path | specify local unique identifier for schedule (use by vProtect)
project-uuid | query |

Request Body
media type | data type | description
--- | --- | ---
application/json | ScheduleRequest (JSON) | specify schedule details to update

Response Body
media type | data type | description
--- | --- | ---
application/json | ScheduleDetails (JSON) | updated details of schedule

#### Example

##### Request

    PUT /schedules/{guid}
    Content-Type: application/json
    Accept: application/json

    {
      "daysOfWeek" : [ {
        "name" : "ENUM_NAME",
        "description" : "Enum description"
      }, {
        "name" : "...",
        "description" : "..."
      } ],
      "backupType" : {
        "name" : "ENUM_NAME",
        "description" : "Enum description"
      }
    }

##### Response

    HTTP/1.1 204 No Content
    Content-Type: application/json

    {
      "guid" : "f8f73bf9-2445-4bce-a7dd-753be3b40a67"
    }