Site Tools

Invoice Retrieval by Order ID API

What is the Invoice Retrieval by Order ID API ?

The Invoice Retrieval by Order ID API allows to download for every order the Invoice if one is present.

Who Should Use this API?

This API is intended to be used in white label business model approach where you want to be in control of the Invoice.

Try it Out

Do you have questions about how your server should retrieve Invoice of the order? Visiting our demo page will help you out.

We’ve developed a sandbox server, which is an isolated server (not hooked up to a payment system or production environment, allowing you to test the service without getting billed) to try out your code and integration with us. As the sandbox server is an isolated server, it requires different credentials than the production site.

The demo page of Invoice Retrieval by Order ID API on sandbox server:

https://imatsandbox.materialise.net/api/demo/documents-retrieval-by-order-id-api.htm

The sandbox and production server contain API demo pages which send well-formed API requests to our site.

The demo page of Invoice Retrieval by Order ID API on production server:

https://i.materialise.com/api/demo/documents-retrieval-by-order-id-api.htm

How Does it Work?

This API requires the personal API code. It is therefore not possible to use AJAX requests.

The Invoice Retrieval by Order ID API works by posting data to our service.

You can use either XML or JSON formats for posting. The HTTP encoding type of a particular request depends on the type of API you are going to use. This will be described in the corresponding section of this page.

To specify the exact content type which your client can accept and parse, the Accept header in your request has to be set to one of the following encoding types:

• text/json
• text/xml

To retrieve Invoice of the order through the Invoice Retrieval by Order ID API , POST a well-structured request via “HTTPS” to this URL:

https://i.materialise.com/web-api/order/[Order ID]/invoice

To use APIs of the sandbox, the POST needs to be submitted to:

https://imatsandbox.materialise.net/web-api/order/[Order ID]/invoice

The API code needs to be specified in the APICode HTTP header.

The Invoice retrieval should be done using GET HTTP Method:

Request Method:GET

Documentation

Request examples

Request Method:GET
...
Accept:text/json
APICode:A1F1BAE8-3F1B-4B8D-8D95-D19E17595034

Structure of the Response

In case of success, Status Code:200 is shown in the response. In the body of response HTML code is retrieved. If to open it code as html page, you will have option to download Invoice file.

Errors Section of the Response

In case of error in the request or when Invoice cannot be retrived, one of following error appears in the response

Code Message Description
100 Order ID is wrong Wrong Order ID was determined in request
101 Wrong API code The order was created by using different API code.
102 No invoice document found in order No custom Invoice file is provided by you for this order or is not available

Example of Response with error in JSON

{
    "error":{
        "message":"No document",
        "code":102
    }
}

Example of Response with error in XML

<InvoiceResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Error>
    <Message>Order ID is wrong</Message>
    <Code>100</Code>
  </Error>
</InvoiceResponse>