File Uploads

Overview

This API can be used to transfer a certificate, key, or CSR file from your computer to the BIG-IQ using a POST. This API uploads the file to /var/config/rest/downloads on the BIG-IQ, which is required to use the SSL Object Management API to create an SSL object which can be managed by BIG-IQ. An unmanaged object cannot be deployed by the BIG-IQ to a BIG-IP.

REST Endpoint: /mgmt/shared/file-transfer/uploads/

Requests

You can upload a file from your computer to /var/config/rest/downloads/<dest-file-name> by sending a POST. The placeholder <dest-file-name> represents the base name of the target file. You should choose a unique target name and only perform one upload at a time.

POST /mgmt/shared/file-transfer/uploads/<dest-file-name>

Request Parameters

The request parameters in a POST request.

Name Type Required Description
end number Required if using the Content-Range header. The values of start and end are the chunk’s delimiters in the file when using the Content-Range header.
headers object False HTTP headers used with the POST request.
     Content-Type string Required The value of the Content-Type header. The correct value for file transfers is “application/octet-stream”. Note that whereas Content-Type for a REST API is application/json generally, with file transfers the Content-Type changes to application/octet-stream.
     Content-Range string Required if the file’s size is greater than 1 Mb. The value of the Content-Range header. Any file upload larger than 1Mb needs to be chunked with this header. The value of Content-Range is (start-end)/size provided in string format.
payload object Required if the entire file is being provided in the body of the POST request. The content of the file as text, if the entire file is being provided in the body of the POST request.
     content string Required if the entire file is being provided in the body of the POST request. The text content of the file being uploaded.
size number Required when using the Content-Range header. Any file larger than 1Mb needs to be chunked with the Content-Range header. The file’s size.
start number Required if using the Content-Range header. The values of start and end are the chunk’s delimiters in the file when using the Content-Range header.

Query Parameters

None

Response

On success, the file represented by <dest-file-name> is saved to the location /var/config/rest/downloads/<dest-file-name>

HTTP/1.1 200 OK

Name Type Description
end number The values of start and end are the chunk’s delimiters in the file when using the Content-Range header.
headers object HTTP headers used with the POST request.
     Content-Type string The value of the Content-Type header. The correct value for file transfers is “application/octet-stream”. Note that whereas Content-Type for a REST API is application/json generally, with file transfers the Content-Type changes to application/octet-stream.
     Content-Range string The value of the Content-Range header. Any file upload larger than 1Mb needs to be chunked with this header. The value of Content-Range is (start-end)/size provided in string format.
localFilePath string /var/config/rest/downloads/<dest-file-name>
payload object The content of the file as text, if the entire file is being provided in the body of the POST request.
     content string The text content of the file being uploaded.
size number The file’s size.
start number The values of start and end are the chunk’s delimiters in the file when using the Content-Range header.
totalByteCount number The total number of bytes in file.

Permissions

Role Allow
admin Yes

DELETE /mgmt/shared/file-transfer/uploads/<dest-file-name>

You can cancel an active upload by sending a DELETE request.

Request Parameters

The request parameters in a DELETE request.

None

Query Parameters

None

Response

On success, the active uploading of the file represented by <dest-file-name> is cancelled.

HTTP/1.1 200 OK

Permissions

Role Allow
admin Yes

Examples

Upload a key file

In the following example, the text content of a key file is uploaded to the destination file located at /var/config/rest/downloads/domain.key on the BIG-IQ.

POST https://192.0.2.242/mgmt/shared/file-transfer/uploads/domain.key

The Json in the body of the POST can look similar to the following example. Sections of the text of the key have been omitted for clarity.

{
    "payload": {
        "content": "-----BEGIN PRIVATE KEY-----MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDXYE5uOaBwXtCYa+inx0X1GsKrpqNBlaytXfzEDVG9YufeEdW/PQuIFwfZbnyXKWOYwpb/zK3KQsM1 .............AMUh/Fx0mYrikVOTC/zcRWj/o3cOUzV8axK0NNTwsBXvSSiY6zdaqw5W9UamFd4g 93YKsn/2nWP/xliN/+54XlAZ -----END PRIVATE KEY----"
    },
    "headers": {
          "Content-Type": "application/octet-stream"
    }
}

Response

On success, the file is saved to the location /var/config/rest/downloads/domain.key. The response to the POST can look similar to the following.

{
    "payload": {
        "content": "-----BEGIN PRIVATE KEY-----MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDXYE5uOaBwXtCYa+inx0X1GsKrpqNBlaytXfzEDVG9YufeEdW/PQuIFwfZbnyXKWOYwpb/zK3KQsM1 .............AMUh/Fx0mYrikVOTC/zcRWj/o3cOUzV8axK0NNTwsBXvSSiY6zdaqw5W9UamFd4g 93YKsn/2nWP/xliN/+54XlAZ -----END PRIVATE KEY----"
    },
    "headers": {
          "Content-Type": "application/octet-stream"
    },
    "totalByteCount": "1234",
    "localFilePath": "/var/config/rest/downloads/domain.key"
}

Upload a CSR file

In the following example curl is used as the client to upload the cert.csr to /var/config/rest/downloads/cert.csr on the BIG-IQ.

curl -i -sk -u admin:admin -X POST -H "Content-Type: application/octet-stream" --data-binary "cert.csr" https://192.0.2.242/mgmt/shared/file-transfer/uploads/cert.csr

Response

On success, the file is saved to the location /var/config/rest/downloads/cert.csr

HTTP/1.1 200 OK