# Fortnox\FortnoxUnitsApi



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

| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
| [**unitControllerDoCreate()**](FortnoxUnitsApi.md#unitControllerDoCreate) | **POST** /3/units | Create a unit |
| [**unitControllerDoDelete()**](FortnoxUnitsApi.md#unitControllerDoDelete) | **DELETE** /3/units/{Code} | Remove a unit |
| [**unitControllerDoIndex()**](FortnoxUnitsApi.md#unitControllerDoIndex) | **GET** /3/units | Retrieve a list of units |
| [**unitControllerDoShow()**](FortnoxUnitsApi.md#unitControllerDoShow) | **GET** /3/units/{Code} | Retrieve a single unit |
| [**unitControllerDoUpdate()**](FortnoxUnitsApi.md#unitControllerDoUpdate) | **PUT** /3/units/{Code} | Update a unit |


## `unitControllerDoCreate()`

```php
unitControllerDoCreate($unit): \Fortnox\Model\FortnoxUnitSingleItemWrap
```

Create a unit

Create an unit

### Example

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



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

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

### Parameters

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

### Return type

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

## `unitControllerDoDelete()`

```php
unitControllerDoDelete($code)
```

Remove a unit

Delete an unit

### Example

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



$apiInstance = new Fortnox\Api\FortnoxUnitsApi(
    // 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()
);
$code = 'code_example'; // string | identifies the unit

try {
    $apiInstance->unitControllerDoDelete($code);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxUnitsApi->unitControllerDoDelete: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **code** | **string**| identifies the unit | |

### Return type

void (empty response body)

### 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)

## `unitControllerDoIndex()`

```php
unitControllerDoIndex(): \Fortnox\Model\FortnoxUnitListItemWrap
```

Retrieve a list of units

The units register can return a list of records or a single record. By specifying a Code in the URL, a single record will be returned. Not specifying a Code will return a list of records.

### Example

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



$apiInstance = new Fortnox\Api\FortnoxUnitsApi(
    // 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()
);

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

### Parameters

This endpoint does not need any parameter.

### Return type

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

## `unitControllerDoShow()`

```php
unitControllerDoShow($code): \Fortnox\Model\FortnoxUnitSingleItemWrap
```

Retrieve a single unit

Retrieve an unit

### Example

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



$apiInstance = new Fortnox\Api\FortnoxUnitsApi(
    // 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()
);
$code = 'code_example'; // string | identifies the unit

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

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **code** | **string**| identifies the unit | |

### Return type

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

## `unitControllerDoUpdate()`

```php
unitControllerDoUpdate($code, $unit): \Fortnox\Model\FortnoxUnitSingleItemWrap
```

Update a unit

Update an unit

### Example

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



$apiInstance = new Fortnox\Api\FortnoxUnitsApi(
    // 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()
);
$code = 'code_example'; // string | identifies the unit
$unit = new \Fortnox\Model\FortnoxUnitSinglePayloadItemWrap(); // \Fortnox\Model\FortnoxUnitSinglePayloadItemWrap | Request body for update unit

try {
    $result = $apiInstance->unitControllerDoUpdate($code, $unit);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxUnitsApi->unitControllerDoUpdate: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

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

### Return type

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