Retrieves the actual file contents for the attachment with the given ID. This API will attempt to infer the MIME type to return from the file's extension, but will return the default value of application/octet-stream if it does not recognize the extension.
Permissions
To use this endpoint, the user is required to have the Forms View (Forms_ViewAccess) permission for the iTwin, or for the form's definition if form definition security is specified. (Having any other Forms permission automatically grants the View permission as well.)
Authentication
Requires Authorization header with valid Bearer token for scope itwin-platform.
For more documentation on authorization and how to get access token visit OAUTH2 Authorization page.
Request parameters
The ID of the form data instance for which to get an attachment.
The ID of the attachment whose file to retrieve.
Request headers
OAuth access token with itwin-platform scope
Setting to application/vnd.bentley.itwin-platform.v2+json is recommended.
Response 200 OK
The attachment's file contents
Response 302 Moved Temporarily
A redirect to a location where the attachment file can be downloaded. Returned in place of the attachment contents for large (>30 MB) files. Do not provide authentication when calling that URL.
Response headers
A URL from which the attachment file can be directly downloaded. This URL is only valid for up to 5 minutes.
Response 401 Unauthorized
This response indicates that request lacks valid authentication credentials. Access token might not been provided, issued by the wrong issuer, does not have required scopes or request headers were malformed.
{ "error": { "code": "HeaderNotFound", "message": "Header Authorization was not found in the request. Access denied." } }
Response 404 Not Found
This response indicates that the specified attachment does not exist (code = 'AttachmentNotFound') or that the attachment metadata instance exists but does not have an associated file (code = 'FileNotFound').
{ "error": { "code": "AttachmentNotFound", "message": "Requested attachment is not available.", "target": "attachmentId" } }
Response 429 Too many requests
This response indicates that the client sent more requests than allowed by this API for the current tier of the client.
{ "error": { "code": "RateLimitExceeded", "message": "The client sent more requests than allowed by this API for the current tier of the client." } }
Response headers
Number of seconds to wait until client is allowed to make more requests.
Error
Contains error information.
One of a server-defined set of error codes.
The target of the error.
A human-readable representation of the error.
{ "type": "object", "required": [ "code", "message" ], "properties": { "code": { "type": "string", "description": "One of a server-defined set of error codes." }, "target": { "type": "string", "nullable": true, "description": "The target of the error." }, "message": { "type": "string", "description": "A human-readable representation of the error." } }, "description": "Contains error information.", "additionalProperties": true }
Error Response
Gives details for an error that occurred while handling the request. Note that clients MUST NOT assume that every failed request will produce an object of this schema, or that all of the properties in the response will be non-null, as the error may have prevented this response from being constructed.
{ "type": "object", "title": "Error Response", "required": [ "error" ], "properties": { "error": { "$ref": "#/components/schemas/Error", "description": "Error information." } }, "description": "Gives details for an error that occurred while handling the request. Note that clients MUST NOT assume that every failed request will produce an object of this schema, or that all of the properties in the response will be non-null, as the error may have prevented this response from being constructed.", "additionalProperties": false }
Was this page helpful?