# Trusted Certificate Chain Controller Resource

### GET /certificates

Returns list of details of certificate chains by given parameters.

Request Parameters
name | type | description | constraints
--- | --- | --- | ---
source | query |  |
source-type | query |  | "BACKUP_DESTINATION" or "HYPERVISOR" or "HYPERVISOR_MANAGER" or "STORAGE_PROVIDER"
sourceHost | query |  |
sourcePort | query |  | int
type | query |  | "SSH_HOST_FINGERPRINT" or "X509"

Response Body
media type | data type | description
--- | --- | ---
application/json | array of TrustedCertificateChainDetails (JSON) | list of details of certificate chains

#### Example

##### Request

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

    ...

##### Response

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

    [ { } ]

### POST /certificates

Creates or updates a certificate chain

Request Body
media type | data type | description
--- | --- | ---
application/json | TrustedCertificateChainRequest (JSON) | specify details of a certificate chain

Response Body
media type | data type | description
--- | --- | ---
application/json | TrustedCertificateChainDetails (JSON) | details of a saved certificate chain

#### Example

##### Request

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

    { }

##### Response

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

    { }

### GET /certificates/by-query

Returns details of a certificate chain by given parameters.

Request Parameters
name | type | description | constraints
--- | --- | --- | ---
source | query |  |
source-type | query |  | "BACKUP_DESTINATION" or "HYPERVISOR" or "HYPERVISOR_MANAGER" or "STORAGE_PROVIDER"
sourceHost | query |  |
sourcePort | query |  | int
type | query |  | "SSH_HOST_FINGERPRINT" or "X509"

Response Body
media type | data type | description
--- | --- | ---
application/json | TrustedCertificateChainDetails (JSON) | details of a certificate

#### Example

##### Request

    GET /certificates/by-query
    Content-Type: */*
    Accept: application/json

    ...

##### Response

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

    { }

### GET /certificates/{guid}

Returns details of a certificate.

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

Response Body
media type | data type | description
--- | --- | ---
application/json | TrustedCertificateChainDetails (JSON) | details of a certificate

#### Example

##### Request

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

    ...

##### Response

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

    { }

### DELETE /certificates/source/{source}/{sourceType}

Deletes a certificate by source

Request Parameters
name | type | description | constraints
--- | --- | --- | ---
source | path | specify source of a certificate |
sourceType | path | specify source type of certificate | "BACKUP_DESTINATION" or "HYPERVISOR" or "HYPERVISOR_MANAGER" or "STORAGE_PROVIDER"

#### Example

##### Request

    DELETE /certificates/source/{source}/{sourceType}
    Content-Type: */*

    ...

##### Response

    HTTP/1.1 204 No Content