Managing Order Invoices

Retrieving Order Invoices

You can retrieve all of your order invoices by sending a GET request to /order-invoices/seller/.

This endpoint provides you all order invoices of which you are the seller.

Example request:

GET https://www.real.de/api/v1/order-invoices/seller/

In the response you will get an array of order invoice like the following:

	[
	{
		  "id_invoice": 155,
          "id_order": "MXE5BY1",
          "original_name": "invoice20190604.pdf",
          "mime_type": "application/pdf",
          "url": "https://real.de/dynamic/files/order_invoices/155/?access_token=f31ac55d337500edff7be20ae14e0bf3",
          "ts_created": "2019-06-04 13:44:02"
	},
	{
		  "id_invoice": 156,
          "id_order": "MXE5BY1",
          "original_name": "invoice20190605.pdf",
          "mime_type": "application/pdf",
          "url": "https://real.de/dynamic/files/order_invoices/156/?access_token=f31ac55d337500edff7be20ae14e0bf3",
          "ts_created": "2019-06-05 13:44:02"
	},
	{
		 "id_invoice": 157,
          "id_order": "MXE5BY1",
          "original_name": "invoice20190606.pdf",
          "mime_type": "application/pdf",
          "url": "https://real.de/dynamic/files/order_invoices/157/?access_token=f31ac55d337500edff7be20ae14e0bf3",
          "ts_created": "2019-06-06 13:44:02"
	}
]

Note: The result is limited by default - please read how to handle pagination.

Retrieving an Invoice of an Order

You can retrieve a specific order invoice by sending a GET request to /order-invoices/{id_order_invoice}/.

This endpoint provides you an order invoice specified by its ID. The response holds the url to download the file. The query parameter of the url (access_token) is a unique, random token to prevent unauthorized access.

Note: DO NOT reveal the token to anyone who is not authorized to access the files.

Example request:

GET https://www.real.de/api/v1/orders-invoices/155/

You will get a JSON response that looks as follows:

{
  "id_invoice": 155,
  "id_order": "MXE5BY1",
  "original_name": "invoice20190604.pdf",
  "mime_type": "application/pdf",
  "url": "https://real.de/dynamic/files/order_invoices/155/?access_token=f31ac55d337500edff7be20ae14e0bf3",
  "ts_created": "2019-06-04 13:44:02"
}

Upload an Invoice to an Order

You can upload an order invoice to an order by sending a POST request to /order-invoices/.

This endpoint allows you to upload an order invoice to an order over the REST API. Please make sure that the data field holds a base64 encoded string of the file content.

Example request:

POST https://www.real.de/api/v1/order-invoices/

Request body:

	{
	"id_order": "MXH6KL8"
	"original_name": "MyNewInvoice.pdf",
	"mime_type": "application/pdf",
	"data": "UmVhbC5EaWdpdGFs"
}

Each response includes an additional HTTP header Location, which contains the ID of the invoice. The header has the format Location: /order-invoices/${id_invoice}/.

For example, in response to the request POST /order-invoices/, the server will return the header Location: /order-invoices/30/, assuming that the newly created record got assigned ID 30.

Delete an Invoice of an Order

You can delete an order invoice from an order by sending a DELETE request to /order-invoices/{id_order_invoice}/.

Example request:

DELETE https://www.real.de/api/v1/order-invoices/156/