# Fortnox\FortnoxOrdersApi



All URIs are relative to https://api.fortnox.se, except if the operation defines another base path.

| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
| [**orderControllerDoCreate()**](FortnoxOrdersApi.md#orderControllerDoCreate) | **POST** /3/orders | Create a new order |
| [**orderControllerDoIndex()**](FortnoxOrdersApi.md#orderControllerDoIndex) | **GET** /3/orders | Retrieve a list of orders |
| [**orderControllerDoShow()**](FortnoxOrdersApi.md#orderControllerDoShow) | **GET** /3/orders/{DocumentNumber} | Retrieve a single order |
| [**orderControllerDoShowAndEmail()**](FortnoxOrdersApi.md#orderControllerDoShowAndEmail) | **GET** /3/orders/{DocumentNumber}/email | Send given order as email |
| [**orderControllerDoShowAndPreview()**](FortnoxOrdersApi.md#orderControllerDoShowAndPreview) | **GET** /3/orders/{DocumentNumber}/preview | Preview given offer |
| [**orderControllerDoShowAndPrint()**](FortnoxOrdersApi.md#orderControllerDoShowAndPrint) | **GET** /3/orders/{DocumentNumber}/print | Print given order |
| [**orderControllerDoUpdate()**](FortnoxOrdersApi.md#orderControllerDoUpdate) | **PUT** /3/orders/{DocumentNumber} | Update an order |
| [**orderControllerDoUpdateAndCancel()**](FortnoxOrdersApi.md#orderControllerDoUpdateAndCancel) | **PUT** /3/orders/{DocumentNumber}/cancel | Cancels given order |
| [**orderControllerDoUpdateAndCreateOrder()**](FortnoxOrdersApi.md#orderControllerDoUpdateAndCreateOrder) | **PUT** /3/orders/{DocumentNumber}/createinvoice | Create invoice out of given order |
| [**orderControllerDoUpdateAndExternalPrint()**](FortnoxOrdersApi.md#orderControllerDoUpdateAndExternalPrint) | **PUT** /3/orders/{DocumentNumber}/externalprint | Set given order as sent |


## `orderControllerDoCreate()`

```php
orderControllerDoCreate($order): \Fortnox\Model\FortnoxOrderOrderResponseWrap
```

Create a new order

An endpoint for creating an order.   Should you have EasyVat enabled, it is mandatory to provide an account in the request should you use a custom VAT rate.   This endpoint can produce errors, some of which may only be relevant for EasyVat. Refer to the table below.  <table>  <caption>Errors that can be raised by this endpoint.</caption>    <tr>     <th>Error Code</th>     <th>HTTP Code</th>     <th>Description</th>     <th>Solution</th>    </tr>    <tr>     <td>2004167</td>     <td>400</td>     <td>An account must be provided when using a custom VAT rate and EasyVat has been enabled.</td>     <td>Supply each row which has a custom VAT rate with an account.</td>    </tr>  </table>

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\FortnoxOrdersApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$order = new \Fortnox\Model\FortnoxOrderOrderSinglePayloadItemWrap(); // \Fortnox\Model\FortnoxOrderOrderSinglePayloadItemWrap | Request body for create order

try {
    $result = $apiInstance->orderControllerDoCreate($order);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxOrdersApi->orderControllerDoCreate: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **order** | [**\Fortnox\Model\FortnoxOrderOrderSinglePayloadItemWrap**](../Model/FortnoxOrderOrderSinglePayloadItemWrap.md)| Request body for create order | [optional] |

### Return type

[**\Fortnox\Model\FortnoxOrderOrderResponseWrap**](../Model/FortnoxOrderOrderResponseWrap.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `orderControllerDoIndex()`

```php
orderControllerDoIndex($todate, $fromdate, $filter, $sortby, $customername, $customernumber, $label, $documentnumber, $externalinvoicereference1, $externalinvoicereference2, $costcenter, $project, $sent, $notcompleted, $ourreference, $yourreference, $lastmodified, $ordertype): \Fortnox\Model\FortnoxOrderOrderListResponseWrap
```

Retrieve a list of orders

Get orders

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\FortnoxOrdersApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$todate = 'todate_example'; // string | filter by to date
$fromdate = 'fromdate_example'; // string | filter by from date
$filter = 'filter_example'; // string | possibility to filter orders
$sortby = 'sortby_example'; // string | field to sort returned list
$customername = 'customername_example'; // string | filter by customer name
$customernumber = 'customernumber_example'; // string | filter by customer number
$label = 'label_example'; // string | filter by label
$documentnumber = 'documentnumber_example'; // string | filter by document number
$externalinvoicereference1 = 'externalinvoicereference1_example'; // string | filter by external invoice reference 1
$externalinvoicereference2 = 'externalinvoicereference2_example'; // string | filter by external invoice reference 2
$costcenter = 'costcenter_example'; // string | filter by cost center
$project = 'project_example'; // string | filter by project
$sent = True; // bool | filter by sent
$notcompleted = True; // bool | filter by not completed
$ourreference = 'ourreference_example'; // string | filter by ourreference
$yourreference = 'yourreference_example'; // string | filter by your reference
$lastmodified = 'lastmodified_example'; // string | filter by lastmodified
$ordertype = 'ordertype_example'; // string | filter by order type

try {
    $result = $apiInstance->orderControllerDoIndex($todate, $fromdate, $filter, $sortby, $customername, $customernumber, $label, $documentnumber, $externalinvoicereference1, $externalinvoicereference2, $costcenter, $project, $sent, $notcompleted, $ourreference, $yourreference, $lastmodified, $ordertype);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxOrdersApi->orderControllerDoIndex: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **todate** | **string**| filter by to date | [optional] |
| **fromdate** | **string**| filter by from date | [optional] |
| **filter** | **string**| possibility to filter orders | [optional] |
| **sortby** | **string**| field to sort returned list | [optional] |
| **customername** | **string**| filter by customer name | [optional] |
| **customernumber** | **string**| filter by customer number | [optional] |
| **label** | **string**| filter by label | [optional] |
| **documentnumber** | **string**| filter by document number | [optional] |
| **externalinvoicereference1** | **string**| filter by external invoice reference 1 | [optional] |
| **externalinvoicereference2** | **string**| filter by external invoice reference 2 | [optional] |
| **costcenter** | **string**| filter by cost center | [optional] |
| **project** | **string**| filter by project | [optional] |
| **sent** | **bool**| filter by sent | [optional] |
| **notcompleted** | **bool**| filter by not completed | [optional] |
| **ourreference** | **string**| filter by ourreference | [optional] |
| **yourreference** | **string**| filter by your reference | [optional] |
| **lastmodified** | **string**| filter by lastmodified | [optional] |
| **ordertype** | **string**| filter by order type | [optional] |

### Return type

[**\Fortnox\Model\FortnoxOrderOrderListResponseWrap**](../Model/FortnoxOrderOrderListResponseWrap.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `orderControllerDoShow()`

```php
orderControllerDoShow($document_number): \Fortnox\Model\FortnoxOrderOrderResponseWrap
```

Retrieve a single order

Retrieve an order

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\FortnoxOrdersApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$document_number = 'document_number_example'; // string | identifies the order

try {
    $result = $apiInstance->orderControllerDoShow($document_number);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxOrdersApi->orderControllerDoShow: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **document_number** | **string**| identifies the order | |

### Return type

[**\Fortnox\Model\FortnoxOrderOrderResponseWrap**](../Model/FortnoxOrderOrderResponseWrap.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `orderControllerDoShowAndEmail()`

```php
orderControllerDoShowAndEmail($document_number): \Fortnox\Model\FortnoxOrderOrderResponseWrap
```

Send given order as email

You can use the properties in the EmailInformation to customize the e-mail message on each order.

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\FortnoxOrdersApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$document_number = 'document_number_example'; // string | identifies the order

try {
    $result = $apiInstance->orderControllerDoShowAndEmail($document_number);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxOrdersApi->orderControllerDoShowAndEmail: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **document_number** | **string**| identifies the order | |

### Return type

[**\Fortnox\Model\FortnoxOrderOrderResponseWrap**](../Model/FortnoxOrderOrderResponseWrap.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `orderControllerDoShowAndPreview()`

```php
orderControllerDoShowAndPreview($document_number): \Fortnox\Model\FortnoxOrderOrderResponseWrap
```

Preview given offer

The difference between this and the print-endpoint is that property Sent is not set to TRUE.

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\FortnoxOrdersApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$document_number = 'document_number_example'; // string | identifies the offer

try {
    $result = $apiInstance->orderControllerDoShowAndPreview($document_number);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxOrdersApi->orderControllerDoShowAndPreview: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **document_number** | **string**| identifies the offer | |

### Return type

[**\Fortnox\Model\FortnoxOrderOrderResponseWrap**](../Model/FortnoxOrderOrderResponseWrap.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/pdf`, `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `orderControllerDoShowAndPrint()`

```php
orderControllerDoShowAndPrint($document_number): \Fortnox\Model\FortnoxOrderOrderResponseWrap
```

Print given order

Retrieve an order

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\FortnoxOrdersApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$document_number = 'document_number_example'; // string | identifies the order

try {
    $result = $apiInstance->orderControllerDoShowAndPrint($document_number);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxOrdersApi->orderControllerDoShowAndPrint: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **document_number** | **string**| identifies the order | |

### Return type

[**\Fortnox\Model\FortnoxOrderOrderResponseWrap**](../Model/FortnoxOrderOrderResponseWrap.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/pdf`, `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `orderControllerDoUpdate()`

```php
orderControllerDoUpdate($document_number, $order): \Fortnox\Model\FortnoxOrderOrderResponseWrap
```

Update an order

Note that there are two approaches for updating the rows on an order.   If RowId is not specified on any row, the rows will be mapped and updated in the order in which they are set in the array. All rows that should remain on the order needs to be provided.   If RowId is specified on one or more rows the following goes: Corresponding row with that id will be updated. The rows without RowId will be interpreted as new rows. If a row should not be updated but remain on the order then specify only RowId like { \"RowId\": 123 }, otherwise it will be removed. Note that new RowIds are generated for all rows every time an order is updated.

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\FortnoxOrdersApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$document_number = 'document_number_example'; // string | identifies the order
$order = new \Fortnox\Model\FortnoxOrderOrderSinglePayloadItemWrap(); // \Fortnox\Model\FortnoxOrderOrderSinglePayloadItemWrap | Request body for update order

try {
    $result = $apiInstance->orderControllerDoUpdate($document_number, $order);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxOrdersApi->orderControllerDoUpdate: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **document_number** | **string**| identifies the order | |
| **order** | [**\Fortnox\Model\FortnoxOrderOrderSinglePayloadItemWrap**](../Model/FortnoxOrderOrderSinglePayloadItemWrap.md)| Request body for update order | [optional] |

### Return type

[**\Fortnox\Model\FortnoxOrderOrderResponseWrap**](../Model/FortnoxOrderOrderResponseWrap.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `orderControllerDoUpdateAndCancel()`

```php
orderControllerDoUpdateAndCancel($document_number, $fortnox_order_order_single_payload_item_wrap): \Fortnox\Model\FortnoxOrderOrderResponseWrap
```

Cancels given order

Update an order

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\FortnoxOrdersApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$document_number = 'document_number_example'; // string | identifies the order
$fortnox_order_order_single_payload_item_wrap = new \Fortnox\Model\FortnoxOrderOrderSinglePayloadItemWrap(); // \Fortnox\Model\FortnoxOrderOrderSinglePayloadItemWrap | Request body for update order

try {
    $result = $apiInstance->orderControllerDoUpdateAndCancel($document_number, $fortnox_order_order_single_payload_item_wrap);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxOrdersApi->orderControllerDoUpdateAndCancel: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **document_number** | **string**| identifies the order | |
| **fortnox_order_order_single_payload_item_wrap** | [**\Fortnox\Model\FortnoxOrderOrderSinglePayloadItemWrap**](../Model/FortnoxOrderOrderSinglePayloadItemWrap.md)| Request body for update order | [optional] |

### Return type

[**\Fortnox\Model\FortnoxOrderOrderResponseWrap**](../Model/FortnoxOrderOrderResponseWrap.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `orderControllerDoUpdateAndCreateOrder()`

```php
orderControllerDoUpdateAndCreateOrder($document_number, $fortnox_order_order_single_payload_item_wrap): \Fortnox\Model\FortnoxOrderOrderResponseWrap
```

Create invoice out of given order

Update an order

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\FortnoxOrdersApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$document_number = 'document_number_example'; // string | identifies the order
$fortnox_order_order_single_payload_item_wrap = new \Fortnox\Model\FortnoxOrderOrderSinglePayloadItemWrap(); // \Fortnox\Model\FortnoxOrderOrderSinglePayloadItemWrap | Request body for update order

try {
    $result = $apiInstance->orderControllerDoUpdateAndCreateOrder($document_number, $fortnox_order_order_single_payload_item_wrap);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxOrdersApi->orderControllerDoUpdateAndCreateOrder: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **document_number** | **string**| identifies the order | |
| **fortnox_order_order_single_payload_item_wrap** | [**\Fortnox\Model\FortnoxOrderOrderSinglePayloadItemWrap**](../Model/FortnoxOrderOrderSinglePayloadItemWrap.md)| Request body for update order | [optional] |

### Return type

[**\Fortnox\Model\FortnoxOrderOrderResponseWrap**](../Model/FortnoxOrderOrderResponseWrap.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `orderControllerDoUpdateAndExternalPrint()`

```php
orderControllerDoUpdateAndExternalPrint($document_number, $fortnox_order_order_single_payload_item_wrap): \Fortnox\Model\FortnoxOrderOrderResponseWrap
```

Set given order as sent

Use this endpoint to set order as sent, without generating an order.

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\FortnoxOrdersApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$document_number = 'document_number_example'; // string | identifies the order
$fortnox_order_order_single_payload_item_wrap = new \Fortnox\Model\FortnoxOrderOrderSinglePayloadItemWrap(); // \Fortnox\Model\FortnoxOrderOrderSinglePayloadItemWrap | Request body for update order

try {
    $result = $apiInstance->orderControllerDoUpdateAndExternalPrint($document_number, $fortnox_order_order_single_payload_item_wrap);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxOrdersApi->orderControllerDoUpdateAndExternalPrint: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **document_number** | **string**| identifies the order | |
| **fortnox_order_order_single_payload_item_wrap** | [**\Fortnox\Model\FortnoxOrderOrderSinglePayloadItemWrap**](../Model/FortnoxOrderOrderSinglePayloadItemWrap.md)| Request body for update order | [optional] |

### Return type

[**\Fortnox\Model\FortnoxOrderOrderResponseWrap**](../Model/FortnoxOrderOrderResponseWrap.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
