The Attachment REST API is designed to expose the capability to upload attachments for storage. The attachments can be then be associated with an invoice for vendor submission.

 

Upload Attachment

The operation uploads an attachment for storage.

Request

Method Request URI HTTP Version
POST {eBHDomain}/attachments/api/v1/attachment HTTP/1.1

Request Headers

The following table describes required and optional request headers.

Request header Description
ProducerId Required. Specifies the client on behalf of which the request is sent.
ProviderKey Required. Specifies the access token.
Content-Type Required. Specifies the body format. A list of valid values: application/octet-stream.
Content-Disposition

Required. Describes the attachments file name. The accepted format is as follows: attachment; filename="{filename}". The file name can have up to 200 characters.

The following file extensions are allowed: PDF,DOC,DOCX,TIF,XLSX,MSG,PNG,TXT,TIFF,XLS,JPG,XML,RTF,LEDES,XPS,XLTX,HTM,XLSB,BMP,CSV,HTML,PPTX,XLSM,JPEG.

Username Optional. Specifies the user on behalf of which the request is sent. The value is used for reporting purposes only and defined by the caller.
Accept Optional. Specifies the expected response format. A list of valid values: application/json (default), */*. 

Request Body

The attachment to upload. Only one file at a time supported. The size of the uploading file is restricted to 10MB or less.

Response

The response includes an HTTP status code, a set of response headers and a response body, which contains the identifier of uploaded attachment.

Status Codes

A successful operation returns status code 201 (Created).

Status code Description
201 CREATED The request was created successfully. See the response body for details.
400 BAD REQUEST The request was incorrectly formatted, missing a required header or parameters were invalid.
401 UNAUTHORIZED The Provider Key is not authorized.
406 NOT ACCEPTABLE Provided Accept HTTP Header is not supported.
413 PAYLOAD TOO LARGE Too large payload size.
415 UNSUPPORTED MEDIA TYPE Provided Content-Type HTTP Header is not supported.
500 INTERNAL SERVER ERROR Something went wrong.

Response Headers

Response header Description
OperationId The unique identifier associated with the request.

Response Body

A request was successfully processed:

The identifier of the uploaded attachment returned.

{
    "Id": " 5b0ef239-376d-4d3d-8f2d-f1121582451c"
}

An error occurred while processing a request:

{
   "Message": "An unexpected error occurred. Please, contact the support team."
}