# OS Agent Controller Resource

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

### GET /os-agents

Returns list of OS Agent list records filtered by specified query parameters.

Request Parameters
name | type | description | constraints
--- | --- | --- | ---
backupStatus | query |  | "IS_PROTECTED" or "NOT_PROTECTED" or "NO_SCHEDULE"
direction | query |  |
filter | query |  |
nameLike | query |  |
orderBy | query |  |
osType | query |  | "LINUX" or "MACOS" or "WINDOWS"
page | query |  |
policy | query |  |
size | query |  |

Response Body
media type | data type | description
--- | --- | ---
application/json | array of OSAgentListRecord (JSON) | list of os-agents list records filtered by specified query parameters

#### Example

##### Request

    GET /os-agents
    Content-Type: */*
    Accept: application/json

    ...

##### Response

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

    [ {
      "guid" : "f8f73bf9-2445-4bce-a7dd-753be3b40a67",
      "lastBackup" : 1451649601000
    } ]

### POST /os-agents/assign-backup-policy

Assign os-agent to specified policy (or unassign if policy is null)

Request Body
media type | data type | description
--- | --- | ---
application/json | ProtectedEntityBackupPolicyAssignmentRequest (JSON) | containing policy and os-agent info

#### Example

##### Request

    POST /os-agents/assign-backup-policy
    Content-Type: application/json

    { }

##### Response

    HTTP/1.1 201 Created

### GET /os-agents/backup-cleanup

Returns list of protected entities for backup cleanup.

Request Parameters
name | type | description | constraints
--- | --- | --- | ---
backup-destination | query |  |
page | query |  | int
size | query |  | int

Response Body
media type | data type | description
--- | --- | ---
application/json | array of OSAgentListRecord (JSON) | list of protected entities for backup cleanup

#### Example

##### Request

    GET /os-agents/backup-cleanup
    Content-Type: */*
    Accept: application/json

    ...

##### Response

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

    [ {
      "guid" : "f8f73bf9-2445-4bce-a7dd-753be3b40a67",
      "lastBackup" : 1451649601000
    } ]

### GET /os-agents/rbac-contexts

Request Parameters
name | type | description | constraints
--- | --- | --- | ---
backupStatus | query |  | "IS_PROTECTED" or "NOT_PROTECTED" or "NO_SCHEDULE"
direction | query |  |
filter | query |  |
nameLike | query |  |
orderBy | query |  |
osType | query |  | "LINUX" or "MACOS" or "WINDOWS"
page | query |  |
policy | query |  |
size | query |  |

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

#### Example

##### Request

    GET /os-agents/rbac-contexts
    Content-Type: */*
    Accept: application/json

    ...

##### Response

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

    [ { } ]

### DELETE /os-agents/{guid}

Remove OS Agent.

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

#### Example

##### Request

    DELETE /os-agents/{guid}
    Content-Type: */*

    ...

##### Response

    HTTP/1.1 204 No Content

### GET /os-agents/{guid}

Get a single OS Agent.

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

Response Body
media type | data type | description
--- | --- | ---
application/json | OSAgentDetails (JSON) | service provider details

#### Example

##### Request

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

    ...

##### Response

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

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

### PUT /os-agents/{guid}

Change OS Agent details.

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

Request Body
media type | data type | description
--- | --- | ---
application/json | OSAgentRequest (JSON) | specify OS Agent details to update

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

#### Example

##### Request

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

    { }

##### Response

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

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

### POST /os-agents/{guid}/decommission

Archive OS Agent.

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

#### Example

##### Request

    POST /os-agents/{guid}/decommission
    Content-Type: */*

    ...

##### Response

    HTTP/1.1 201 Created

### GET /os-agents/{guid}/list-backups

Returns list of OSAgent backups.

Request Parameters
name | type | description | constraints
--- | --- | --- | ---
guid | path |  |
roleType | query |  | "ARCHIVE" or "PRIMARY" or "SECONDARY"

Response Body
media type | data type | description
--- | --- | ---
application/json | array of number (JSON) | list of OSAgent backups

#### Example

##### Request

    GET /os-agents/{guid}/list-backups
    Content-Type: */*
    Accept: application/json

    ...

##### Response

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

    ...