# Allocated Resource Controller Resource

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

### GET /allocatedresource

Returns list of allocated resource.

Request Parameters
name | type | description
--- | --- | ---
node-guid | query |
protected-entity-guid | query |
resource | query |

Response Body
media type | data type | description
--- | --- | ---
application/json | array of AllocatedResourceDetails (JSON) | list of allocated resource.

#### Example

##### Request

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

    ...

##### Response

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

    [ { } ]

### POST /allocatedresource

Create allocated resource or get an existing one.

Request Body
media type | data type | description
--- | --- | ---
application/json | AllocatedResourceRequest (JSON) | specify allocated resource.

Response Body
media type | data type | description
--- | --- | ---
application/json | AllocatedResourceDetails (JSON) | newly created or existing allocated resource.

#### Example

##### Request

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

    { }

##### Response

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

    { }

### POST /allocatedresource/for-node

Create allocated resource for specified node or get an existing one.

Request Body
media type | data type | description
--- | --- | ---
application/json | AllocatedResourceRequest (JSON) | specify allocated resource.

Response Body
media type | data type | description
--- | --- | ---
application/json | AllocatedResourceDetails (JSON) | newly created or existing allocated resource.

#### Example

##### Request

    POST /allocatedresource/for-node
    Content-Type: application/json
    Accept: application/json

    { }

##### Response

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

    { }

### DELETE /allocatedresource/{guid}

Remove allocated resource.

Request Parameters
name | type | description
--- | --- | ---
guid | path | specify local unique identifier for allocated resource (use by vProtect)
node-guid | query |

#### Example

##### Request

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

    ...

##### Response

    HTTP/1.1 204 No Content

### GET /allocatedresource/{guid}

Get a single allocated resource.

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

Response Body
media type | data type | description
--- | --- | ---
application/json | AllocatedResourceDetails (JSON) | allocated resource

#### Example

##### Request

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

    ...

##### Response

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

    { }

### PUT /allocatedresource/{guid}

Update allocated resource.

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

Request Body
media type | data type | description
--- | --- | ---
application/json | UpdateAllocatedResourceRequest (JSON) | specify allocated resource properties to update

Response Body
media type | data type | description
--- | --- | ---
application/json | AllocatedResourceDetails (JSON) | updated details of allocated resource

#### Example

##### Request

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

    { }

##### Response

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

    { }

### DELETE /allocatedresource/{guid}/if-necessary

Remove allocated resource if enough attemptCount were made

Request Parameters
name | type | description | constraints
--- | --- | --- | ---
guid | path | specify local unique identifier for allocated resource (use by vProtect) |
max-removal-attemptCount | query |  | required int
node-guid | query |  |

#### Example

##### Request

    DELETE /allocatedresource/{guid}/if-necessary
    Content-Type: */*

    ...

##### Response

    HTTP/1.1 204 No Content