POST InvoiceAttachment

Inserts an attachment for the specified File and User.

Request Information

URI Parameters

Name Description Type Additional information
WsAccessKey The Web Service access key for this user and file which allows access to the API for the associated file (found in File - Settings). Using OAuth authentication mechanism is the preferred method to allow API access. string

Optional. Legacy authentication method and only required if not using OAuth. OAuth is preferred.

FileId Specifies the file id of the file to perform the operation upon. integer

Required

Body Parameters

FileAttachment
Name Description Type Additional information
AttachmentData This is an array of bytes and represents the data of the attachment (ie. the attachment itself). You must convert the file you want to attach into a byte array. This is usually done programmatically which our client code does for you. This process is called serialisation and more information on this can be found here - http://en.wikipedia.org/wiki/Serialization Collection of byte

None.

AllowExistingAttachmentToBeOverwritten A flag that indicates if an attachment of the same name already exists, whether it can be overwritten or not when storing. boolean

None.

Name Name of the attachment. string

None.

Description Description of the attachment. string

None.

ItemIdAttachedTo The Id of the item/entity that this attachment is associated with or attached to. integer

None.

_links Hypermedia links. Contains contextual links to possible next actions related to this resource. Only present in responses. This data is not to be sent to the server. Collection of Link

None.

Request Formats

application/json, text/json

Sample:
{
  "AttachmentData": null,
  "AllowExistingAttachmentToBeOverwritten": false,
  "Name": "Toy sale.doc",
  "Description": "Toy sale invoice",
  "ItemIdAttachedTo": 18616,
  "_links": []
}

application/xml, text/xml

Sample:
<FileAttachment xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <_links />
  <Name>Toy sale.doc</Name>
  <Description>Toy sale invoice</Description>
  <ItemIdAttachedTo>18616</ItemIdAttachedTo>
  <AllowExistingAttachmentToBeOverwritten>false</AllowExistingAttachmentToBeOverwritten>
</FileAttachment>

Response Information

Resource Description

InsertAttachmentResult
Name Description Type Additional information
Id The Id/Key of the created/inserted attachment. integer

None.

_links Hypermedia links. Contains contextual links to possible next actions related to this resource. Only present in responses. This data is not to be sent to the server. Collection of Link

None.

Response Formats

application/json, text/json

Sample:
{
  "Id": 123,
  "_links": [
    {
      "rel": "self",
      "href": "https://api.saasu.com/InvoiceAttachment?FileId=123",
      "method": "POST",
      "title": null
    }
  ]
}

application/xml, text/xml

Sample:
<InsertAttachmentResult xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <_links>
    <Link>
      <rel>self</rel>
      <href>https://api.saasu.com/InvoiceAttachment?FileId=123</href>
      <method>POST</method>
    </Link>
  </_links>
  <Id>123</Id>
</InsertAttachmentResult>