# GetReturnOrders (REST)

**Description**

Endpoint used to retrieve a list of return orders of a customer. These orders will come directly from the ERP system and can contain our web orders but also orders placed in the shop or by phone.

Note that the orders should be returned in reversed order. The return order history is shown on the shop in a paged manner. The first page contains the most recent orders with the latest order on top of the list.

## REST API:

**URL:** /Shoxl/v1/GetReturnOrders\
**Method:** POST

**Request body:**

### &#x20;GetOrderHistoryRequest{

| Parameter     | Type                      | Description                                                                     |
| ------------- | ------------------------- | ------------------------------------------------------------------------------- |
| accountNumber | <p>string<br>required</p> | The (project) account number of the customer.                                   |
| pageNumber    | integer($int32)           | The number of the page. The page numbering is 1-based: first page has number 1. |
| pageSize      | integer($int32)           | The maximum number of items to be returned on a page.                           |

}

#### Example:

```
{
  "accountNumber": "123456",
  "pageNumber": 1,
  "pageSize": 20
}
```

**Response body:**

### &#x20;GetReturnOrdersResult{

| Parameter        | Type                            | Description                                                                                                                                                                                                                                                                                                          |
| ---------------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| errorCode        | <p>string<br>nullable: true</p> | An error code returned by the ERP system                                                                                                                                                                                                                                                                             |
| errorDescription | <p>string<br>nullable: true</p> | The error description related to the error code returned by the ERP system                                                                                                                                                                                                                                           |
| orders           | \[ReturnOrderItem]              | A list of ReturnOrderItems, the ComplexType ReturnOrderItem contains some order details like; order date and order number. For the complete description check the ReturnOrderItem section in the documentation. The maximum number of orders returned by ERP is determined by the pageSize parameter of the request. |
| request          | GetReturnOrdersRequest          | The request sent by the Shoxl Shop.                                                                                                                                                                                                                                                                                  |
| totalPages       | integer($int32)                 | Total number of pages with results                                                                                                                                                                                                                                                                                   |
| pageNumber       | integer($int32)                 | The number of the page                                                                                                                                                                                                                                                                                               |

}

#### &#x20;ReturnOrderItem{

| Parameter   | Type                            | Description                                                                                                                                                                                                                    |
| ----------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| orderDate   | string($date-time)              | The order date                                                                                                                                                                                                                 |
| orderNumber | <p>string<br>nullable: true</p> | The Shoxl Shop unique order number                                                                                                                                                                                             |
| orderState  | integer($int32)                 | Orderstate: 1 = *Open*, 2 = *Closed*. State should be derived form orderlinestates: 1 means 1 or more lines have state *ToReturn*, *PartiallyReturned* or *Ret*urned, 2 means all lines have status *Credited* or *Cancelled*. |
| reference   | <p>string<br>nullable: true</p> | The customer order reference                                                                                                                                                                                                   |

}

#### Example:

```
{
  "errorCode": "string",
  "errorDescription": "string",
  "orders": [
    {
      "orderDate": "2021-07-21T12:55:00.826Z",
      "orderNumber": "123456",
      "reference": "string",
      "orderState": 1
    }
  ],
  "request": {
    "accountNumber": "string",
    "pageNumber": 1
    "pageSize": 20
  },
  "totalPages": 12,
  "pageNumber": 1
}
```
