# Fortnox\FortnoxContractsApi



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

| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
| [**contractControllerDoCreate()**](FortnoxContractsApi.md#contractControllerDoCreate) | **POST** /3/contracts | Create a contract |
| [**contractControllerDoIndex()**](FortnoxContractsApi.md#contractControllerDoIndex) | **GET** /3/contracts | Retrieve a list of contracts |
| [**contractControllerDoShow()**](FortnoxContractsApi.md#contractControllerDoShow) | **GET** /3/contracts/{DocumentNumber} | Retrieve a single contract |
| [**contractControllerDoUpdate()**](FortnoxContractsApi.md#contractControllerDoUpdate) | **PUT** /3/contracts/{DocumentNumber} | Update a contract |
| [**contractControllerDoUpdateAndCreateInvoice()**](FortnoxContractsApi.md#contractControllerDoUpdateAndCreateInvoice) | **PUT** /3/contracts/{DocumentNumber}/createinvoice | Create invoice from contract |
| [**contractControllerDoUpdateAndFinish()**](FortnoxContractsApi.md#contractControllerDoUpdateAndFinish) | **PUT** /3/contracts/{DocumentNumber}/finish | Set a contract as finished |
| [**contractControllerDoUpdateAndIncreaseInvoiceCount()**](FortnoxContractsApi.md#contractControllerDoUpdateAndIncreaseInvoiceCount) | **PUT** /3/contracts/{DocumentNumber}/increaseinvoicecount | Increases the invoice count without creating an invoice |


## `contractControllerDoCreate()`

```php
contractControllerDoCreate($contract): \Fortnox\Model\FortnoxContractInvoiceContractResponseWrap
```

Create a contract

Create a contract

### Example

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



$apiInstance = new Fortnox\Api\FortnoxContractsApi(
    // 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()
);
$contract = new \Fortnox\Model\FortnoxContractInvoiceContractCreatePayloadWrap(); // \Fortnox\Model\FortnoxContractInvoiceContractCreatePayloadWrap | Request body for create contract

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

### Parameters

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

### Return type

[**\Fortnox\Model\FortnoxContractInvoiceContractResponseWrap**](../Model/FortnoxContractInvoiceContractResponseWrap.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)

## `contractControllerDoIndex()`

```php
contractControllerDoIndex($periodstart, $periodend, $filter, $documentnumber, $customernumber, $templatenumber, $invoicesremaining, $lastmodified): \Fortnox\Model\FortnoxContractInvoiceContractListResponseWrap
```

Retrieve a list of contracts

Get contracts

### Example

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



$apiInstance = new Fortnox\Api\FortnoxContractsApi(
    // 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()
);
$periodstart = new \DateTime('2013-10-20T19:20:30+01:00'); // \DateTime | Filter contracts by start of contract period
$periodend = new \DateTime('2013-10-20T19:20:30+01:00'); // \DateTime | Filter contracts by end of contract period
$filter = 'filter_example'; // string | Filter contracts by status
$documentnumber = 56; // int | Filter contracts by document number
$customernumber = 'customernumber_example'; // string | Filter contracts by customer number
$templatenumber = 56; // int | Filter contracts by template number
$invoicesremaining = 56; // int | Filter contracts by number of remaining invoices
$lastmodified = new \DateTime('2013-10-20T19:20:30+01:00'); // \DateTime | Filter contracts by last modified date

try {
    $result = $apiInstance->contractControllerDoIndex($periodstart, $periodend, $filter, $documentnumber, $customernumber, $templatenumber, $invoicesremaining, $lastmodified);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxContractsApi->contractControllerDoIndex: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **periodstart** | **\DateTime**| Filter contracts by start of contract period | [optional] |
| **periodend** | **\DateTime**| Filter contracts by end of contract period | [optional] |
| **filter** | **string**| Filter contracts by status | [optional] |
| **documentnumber** | **int**| Filter contracts by document number | [optional] |
| **customernumber** | **string**| Filter contracts by customer number | [optional] |
| **templatenumber** | **int**| Filter contracts by template number | [optional] |
| **invoicesremaining** | **int**| Filter contracts by number of remaining invoices | [optional] |
| **lastmodified** | **\DateTime**| Filter contracts by last modified date | [optional] |

### Return type

[**\Fortnox\Model\FortnoxContractInvoiceContractListResponseWrap**](../Model/FortnoxContractInvoiceContractListResponseWrap.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)

## `contractControllerDoShow()`

```php
contractControllerDoShow($document_number): \Fortnox\Model\FortnoxContractInvoiceContractResponseWrap
```

Retrieve a single contract

Retrieve a contract

### Example

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



$apiInstance = new Fortnox\Api\FortnoxContractsApi(
    // 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 contract

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

### Parameters

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

### Return type

[**\Fortnox\Model\FortnoxContractInvoiceContractResponseWrap**](../Model/FortnoxContractInvoiceContractResponseWrap.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)

## `contractControllerDoUpdate()`

```php
contractControllerDoUpdate($document_number, $contract): \Fortnox\Model\FortnoxContractInvoiceContractResponseWrap
```

Update a contract

Note that there are two approaches for updating the rows on a contract.   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 contract 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 contract then specify only RowId like { \"RowId\": 123 }, otherwise it will be removed. Note that new RowIds are generated for all rows every time a contract is updated.   When the InvoiceDiscount value is set on the rows and the Contract, the value set on the Contract takes precedence over the row-level InvoiceDiscount.

### Example

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



$apiInstance = new Fortnox\Api\FortnoxContractsApi(
    // 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 contract
$contract = new \Fortnox\Model\FortnoxContractInvoiceContractUpdatePayloadWrap(); // \Fortnox\Model\FortnoxContractInvoiceContractUpdatePayloadWrap | Request body for update contract

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

### Parameters

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

### Return type

[**\Fortnox\Model\FortnoxContractInvoiceContractResponseWrap**](../Model/FortnoxContractInvoiceContractResponseWrap.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)

## `contractControllerDoUpdateAndCreateInvoice()`

```php
contractControllerDoUpdateAndCreateInvoice($document_number, $invoicedate, $fortnox_contract_invoice_contract_update_and_create_invoice_payload_wrap): \Fortnox\Model\FortnoxContractInvoiceContractResponseWrap
```

Create invoice from contract

Update a contract

### Example

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



$apiInstance = new Fortnox\Api\FortnoxContractsApi(
    // 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 contract
$invoicedate = new \DateTime('2013-10-20T19:20:30+01:00'); // \DateTime | Date of invoicing
$fortnox_contract_invoice_contract_update_and_create_invoice_payload_wrap = new \Fortnox\Model\FortnoxContractInvoiceContractUpdateAndCreateInvoicePayloadWrap(); // \Fortnox\Model\FortnoxContractInvoiceContractUpdateAndCreateInvoicePayloadWrap | Request body for update contract

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

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **document_number** | **string**| identifies the contract | |
| **invoicedate** | **\DateTime**| Date of invoicing | [optional] |
| **fortnox_contract_invoice_contract_update_and_create_invoice_payload_wrap** | [**\Fortnox\Model\FortnoxContractInvoiceContractUpdateAndCreateInvoicePayloadWrap**](../Model/FortnoxContractInvoiceContractUpdateAndCreateInvoicePayloadWrap.md)| Request body for update contract | [optional] |

### Return type

[**\Fortnox\Model\FortnoxContractInvoiceContractResponseWrap**](../Model/FortnoxContractInvoiceContractResponseWrap.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)

## `contractControllerDoUpdateAndFinish()`

```php
contractControllerDoUpdateAndFinish($document_number, $fortnox_contract_invoice_contract_update_and_finish_payload_wrap): \Fortnox\Model\FortnoxContractInvoiceContractResponseWrap
```

Set a contract as finished

Update a contract

### Example

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



$apiInstance = new Fortnox\Api\FortnoxContractsApi(
    // 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 contract
$fortnox_contract_invoice_contract_update_and_finish_payload_wrap = new \Fortnox\Model\FortnoxContractInvoiceContractUpdateAndFinishPayloadWrap(); // \Fortnox\Model\FortnoxContractInvoiceContractUpdateAndFinishPayloadWrap | Request body for update contract

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

### Parameters

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

### Return type

[**\Fortnox\Model\FortnoxContractInvoiceContractResponseWrap**](../Model/FortnoxContractInvoiceContractResponseWrap.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)

## `contractControllerDoUpdateAndIncreaseInvoiceCount()`

```php
contractControllerDoUpdateAndIncreaseInvoiceCount($document_number, $fortnox_contract_invoice_contract_update_and_increase_invoice_count_payload_wrap): \Fortnox\Model\FortnoxContractInvoiceContractResponseWrap
```

Increases the invoice count without creating an invoice

Update a contract

### Example

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



$apiInstance = new Fortnox\Api\FortnoxContractsApi(
    // 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 contract
$fortnox_contract_invoice_contract_update_and_increase_invoice_count_payload_wrap = new \Fortnox\Model\FortnoxContractInvoiceContractUpdateAndIncreaseInvoiceCountPayloadWrap(); // \Fortnox\Model\FortnoxContractInvoiceContractUpdateAndIncreaseInvoiceCountPayloadWrap | Request body for update contract

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

### Parameters

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

### Return type

[**\Fortnox\Model\FortnoxContractInvoiceContractResponseWrap**](../Model/FortnoxContractInvoiceContractResponseWrap.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)
