bids/attachments
Creates a bid attachment that can be included in a bid’s attachments array. The maximum file size for an attachment is 25MB.
This endpoint returns a temporary URL and form data with which you must upload the attachment to S3 cloud storage before you can include it in a bid. The upload URL will expire at the time indicated by the value of expiresAt
in the response.
Note that the new attachment is not automatically associated with a particular bid. Once you add it to a bid’s attachment array, it can be added only to future revisions of the same bid.
For more information about using the URL and form data to upload the attachment, see the Create Bids and Attachments tutorial.
Resource Information
Method and URI | POST https://developer.api.autodesk.com/construction/buildingconnected/v2/bids/attachments |
Authentication Context | user context required |
Required OAuth Scopes | data:write |
Data Format | JSON |
Request
Headers
Authorization* string | Must be Bearer <token> , where <token> is obtained via a three-legged OAuth flow. |
Content-Type* string | Must be application/json |
Request
Body Structure
name* string | The attachment’s file name.
The name is required and must not be empty. |
size* number | The attachment’s size in bytes. Maximum 25MB.
If this value doesn’t match the detected size of the file upon upload, it will be automatically corrected to the actual size. |
Response
HTTP Status Code Summary
201 Created | Created |
400 Bad Request | The parameters of the requested operation are invalid. |
401 Unauthorized | The provided bearer token is not valid. |
403 Forbidden | The user or service represented by the bearer token does not have permission to perform this operation. |
404 Not Found | The requested resource could not be found. |
429 Too Many Requests | Rate limit exceeded; wait some time before retrying. The ‘Retry-After’ header might provide the amount of the time to wait. |
500 Internal Server Error | An unknown error occurred on the server. |
Response
Body Structure (201)
id string | The unique ID of the attachment.
Max length: 24 |
name string | The name of the attachment. |
size number | The size of the attachment in bytes. |
method enum:string | The HTTP method to use for the upload.
Possible values: POST , PUT |
url string | The URL to use for uploading the attachment to S3. This URL will expire after 2 minutes (at the time indicated by the value of expiresAt ).
Note that you must begin the upload before the URL expires, but the subsequent data transfer can take much longer. |
headers object | The HTTP headers to add to the upload request. |
* string | |
formData object | If this object is present in the response, the upload must be encoded as multipart/form-data with key-value pairs in this object as form-data and the file data as file in the form.
If this object is absent from the response, the upload must be sent as binary data. |
expiresAt datetime: ISO 8601 | The time at which the upload URL expires. |
Example
Created
Request
curl -v 'https://developer.api.autodesk.com/construction/buildingconnected/v2/bids/attachments' \
-X 'POST' \
-H 'Authorization: Bearer AuIPTf4KYLTYGVnOHQ0cuolwCW2a' \
-H 'Content-Type: application/json' \
-d '{
"name": "attachment.pdf",
"size": 1253011
}'
Response
{
"id": "5d1ca35b3935dc00a8b18d79",
"name": "",
"size": 524288,
"method": "POST",
"url": "https://s3.amazonaws.com/files.buildingconnected.com/",
"headers": {},
"formData": {
"policy": "ABCDEFGHIJKLMNOP=",
"signature": "cdefghijklmnop=,",
"key": "/attachments/1234567/xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"Content-Type": "application/pdf",
"AWSAccessKeyId": "ACCESS_KEY_ID",
"acl": "private",
"Content-Disposition": "attachment;filename*=UTF-8''doc.pdf;filename=\"doc.pdf\"",
"success_action_status": 201
},
"expiresAt": ""
}