Create a website

Try UGAL for free for 30 days

No commitment, no credit card required

Order attachments

Attachments can be added to orders by external services to provide information about the order fulfillment, like invoices, tracking numbers or RMAs. Each order can have one or multiple attachments.

The order attachments API application allows to retrieve and manipulate information on order attachments. The order attachments API application requires website authentication.

Only attachments of type url are supported for now. They represent documents that are hosted with external services (e.g. invoices provided by an invoicing application).

Read a collection of attachments

URL GET @ http://{sitename}.ugal.com/api/v1/orders/{orderId}/attachments.xml

Returns the collection of all attachments attached to the specified orders.

// Status: 200 OK
<attachments>
    <attachment>
        <id>130376</id>
        <title>Your invoice #130904</title>
        <date>2015-07-20</date>
        <type>invoice</type>
        <provider>UGAL</provider>
        <format>url</format>
        <url>http://attach.ugal.net/invoices/4dccfc736363c150.pdf</url>
        <link>http://sitename.ugal.com/api/v1/orders/131061/attachments/130376.xml</link>
    </attachment>
    {...}
</attachments>

Read an attachment

URL GET @ http://{sitename}.ugal.com/api/v1/orders/{orderId}/attachments/130376.xml

Returns a representation of the order attachment:

// Status: 200 OK
<attachment>
    <id>130376</id>
    <title>Your invoice #130904</title>
    <date>2015-07-20</date>
    <type>invoice</type>
    <provider>UGAL</provider>
    <format>url</format>
    <url>http://attach.ugal.net/invoices/4dccfc736363c150.pdf</url>
    <created-at>2015-07-20T12:19:26Z</created-at>
    <updated-at>2015-07-20T12:19:26Z</updated-at>
</attachment>

Notes:

  • The <url> element is present only for attachments of format url.
  • The <content> element is present for attachments of format other than url.

Create an attachment

URL POST @ http://{sitename}.ugal.com/api/v1/orders/{orderId}/attachments.xml
Body
<attachment>
    <title>Your invoice #130904</title>
    <date>2015-07-20</date>
    <type>invoice</type>
    <provider>UGAL</provider>
    <format>url</format>
    <url>http://attach.ugal.net/invoices/4dccfc736363c150.pdf</url>
</attachment>

Returns a 201 status code, with the representation of the attachment that was created in the body:

// Status: 201 Created
// Location: http://asite.ugal.dev/api/v1/orders/131279/attachments/130377.xml
<attachment>
    <id>130377</id>
    ...
</attachment>

Update an attachment

  • At the exception of the id, created-at and updated-at properties, all the properties of an attachment can be updated.
  • You can send data in the request body for all properties or only for the properties you want to update.
URL PUT @ http://{sitename}.ugal.com/api/v1/orders/{orderId}/attachments/{attachmentId}.xml
Body
<attachment>
    <url>http://attach.ugal.net/invoices/125e10c13fd6b7af.pdf</url>
</attachment>

In this example, only the url property of the attachment will be updated.

Returns the updated representation of the attachment:

// Status: 200 OK
<attachment>
    <id>130377</id>
    ...
</attachment>

Delete an attachment

  • Any attachment can be deleted at any time.
URL DELETE @ http://{sitename}.ugal.com/api/v1/orders/{orderId}/attachments/{attachmentId}.xml

Returns a 204 status code with an empty response body:

// Status: 204 Deleted

Create a website

Try UGAL for free for 30 days

No commitment, no credit card required

Newsletter subscription