REST v.2 uploads
Files containing additional information that might be required for executing the step or performing the deployment task are added as documents for a step.
new in 5.0.03.001POST v2/steps/[step_ID] or [request_ID]/upload
Uploads attachments to the specified step or request.
Requests should be either multipart/form-data or application/x-www-form-urlencoded POST formats.
Common attributes
- media_data — Specify the raw binary of the file. Max file size allowed is 5MB.
- description — Enter more information about the document (up to 255 characters only)
Note: Description can be specified only while uploading attachments to a step. - format — Ensure to include an accept header or add .json to the last path element
- token — Your API Token for authentication
Errors caused
- ERROR 403 Forbidden — When the token is invalid
- ERROR 422 Unprocessable Entity — When validation fails
Example for uploading attachments to a step
To test this method, insert this URL or your valid API key and application host into a browser or HTTP client like wget or curl. For example:
http://[rails_host]/v2/steps/[step_ID]/upload?token=[api_token]
Host: localhost:8080
User-Agent: curl/7.45.0
Accept: /
Content-Length: 367
Expect: 100-continue
Content-Type: multipart/form-data; boundary=------------------------a223aca33374ded8
HTTP/1.1 100 Continue
} [259 bytes data]
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-UA-Compatible: IE=Edge
ETag: "dfc0a1d485dbec625c5d8f042e60ad01"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: f9c07c3c1f2411e30b79e57d5c316a09
X-Runtime: 0.573000
Vary: Origin
Referrer-Policy: origin-when-cross-origin
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: DENY
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block
Content-Type: application/json;charset=utf-8
Transfer-Encoding: chunked
Date: Wed, 18 Apr 2018 11:59:53 GMT
{"id":53}
Example for uploading attachments to a request
To test this method, insert this URL or your valid API key and application host into a browser or HTTP client like wget or curl. For example:
http://vl-pun-rpm-1234.bmc.com:8080/brpm/v2/requests/1/upload?token=1daa7aff4b6e1b72945274c2566dfb8bbe432108
Host: localhost:8080
User-Agent: curl/7.45.0
Accept: /
Content-Length: 367
Expect: 100-continue
Content-Type: multipart/form-data; boundary=------------------------a223aca33374ded8
HTTP/1.1 100 Continue
} [259 bytes data]
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-UA-Compatible: IE=Edge
ETag: "dfc0a1d485dbec625c5d8f042e60ad01"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: f9c07c3c1f2411e30b79e57d5c316a09
X-Runtime: 0.573000
Vary: Origin
Referrer-Policy: origin-when-cross-origin
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: DENY
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block
Content-Type: application/json;charset=utf-8
Transfer-Encoding: chunked
Date: Wed, 18 Apr 2018 11:59:53 GMT
{"id":53}
GET v2/steps/[step_ID]/uploads
Returns documents uploaded for a specified step.
Common attributes
- format — Ensure to include an accept header or add .json to the last path element
- token — Your API Token for authentication
Errors caused
- ERROR 403 Forbidden — When the token is invalid
- ERROR 404 Not Found — When no records are found
Example
To test this method, insert this URL or your valid API key and application host into a browser or HTTP client like wget or curl. For example:
Server: Apache-Coyote/1.1
X-UA-Compatible: IE=Edge,chrome=1
ETag: "3a653c8085b9fa60d7c02e6bb83dfdba"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 1d5bd17a51444dca068130c374c76f33
X-Runtime: 0.031000
Date: Thu, 07 Dec 2017 15:10:31 GMT
X-Rack-Cache: miss
Vary: Origin
Referrer-Policy: origin-when-cross-origin
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: DENY
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block
Content-Type: application/json;charset=utf-8
Transfer-Encoding: chunked
{
"data": [
{
"content_type": "application/octet-stream",
"created_at": "2017-12-07T08:12:10-06:00",
"deleted": false,
"description": " ",
"filename": "docker-compose-template-53-POSTGRE__1_.yml",
"id": 16,
"updated_at": "2017-12-07T08:12:10-06:00",
"user_name": "Administrator, John"
}
],
"total_records": 1
}
GET v2/uploads/[document_ID]
Downloads the specified attachment.
Common attributes
- format — Ensure to include an accept header or add .json to the last path element
- token — Your API Token for authentication
Errors caused
- ERROR 403 Forbidden — When the token is invalid
- ERROR 404 Not Found — When no records are found
Example
To test this method, insert this URL or your valid API key and application host into a browser or HTTP client like wget or curl. For example:
The document is downloaded in the folder from which the command is run.
Related topics