# Fortnox\FortnoxCostCentersApi



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

| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
| [**costCenterControllerDoCreate()**](FortnoxCostCentersApi.md#costCenterControllerDoCreate) | **POST** /3/costcenters | Create a cost center |
| [**costCenterControllerDoDelete()**](FortnoxCostCentersApi.md#costCenterControllerDoDelete) | **DELETE** /3/costcenters/{Code} | Remove a cost center |
| [**costCenterControllerDoIndex()**](FortnoxCostCentersApi.md#costCenterControllerDoIndex) | **GET** /3/costcenters | Retrieve a list of cost centers |
| [**costCenterControllerDoShow()**](FortnoxCostCentersApi.md#costCenterControllerDoShow) | **GET** /3/costcenters/{Code} | Retrieve a single cost center |
| [**costCenterControllerDoUpdate()**](FortnoxCostCentersApi.md#costCenterControllerDoUpdate) | **PUT** /3/costcenters/{Code} | Update a cost center |


## `costCenterControllerDoCreate()`

```php
costCenterControllerDoCreate($cost_center): \Fortnox\Model\FortnoxCostCenterSingleItemWrap
```

Create a cost center

Create a cost center

### Example

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



$apiInstance = new Fortnox\Api\FortnoxCostCentersApi(
    // 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()
);
$cost_center = new \Fortnox\Model\FortnoxCostCenterSinglePayloadItemWrap(); // \Fortnox\Model\FortnoxCostCenterSinglePayloadItemWrap | Request body for create cost center

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

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **cost_center** | [**\Fortnox\Model\FortnoxCostCenterSinglePayloadItemWrap**](../Model/FortnoxCostCenterSinglePayloadItemWrap.md)| Request body for create cost center | [optional] |

### Return type

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

## `costCenterControllerDoDelete()`

```php
costCenterControllerDoDelete($code)
```

Remove a cost center

Delete a cost center

### Example

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



$apiInstance = new Fortnox\Api\FortnoxCostCentersApi(
    // 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 cost center to remove

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

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **code** | **string**| identifies the cost center to remove | |

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

## `costCenterControllerDoIndex()`

```php
costCenterControllerDoIndex(): \Fortnox\Model\FortnoxCostCenterListItemWrap
```

Retrieve a list of cost centers

The cost centers 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\FortnoxCostCentersApi(
    // 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->costCenterControllerDoIndex();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FortnoxCostCentersApi->costCenterControllerDoIndex: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

This endpoint does not need any parameter.

### Return type

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

## `costCenterControllerDoShow()`

```php
costCenterControllerDoShow($code): \Fortnox\Model\FortnoxCostCenterSingleItemWrap
```

Retrieve a single cost center

Retrieve a cost center

### Example

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



$apiInstance = new Fortnox\Api\FortnoxCostCentersApi(
    // 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 cost center

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

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **code** | **string**| identifies the cost center | |

### Return type

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

## `costCenterControllerDoUpdate()`

```php
costCenterControllerDoUpdate($code, $cost_center): \Fortnox\Model\FortnoxCostCenterSingleItemWrap
```

Update a cost center

Update a cost center

### Example

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



$apiInstance = new Fortnox\Api\FortnoxCostCentersApi(
    // 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 cost center
$cost_center = new \Fortnox\Model\FortnoxCostCenterSinglePayloadItemWrap(); // \Fortnox\Model\FortnoxCostCenterSinglePayloadItemWrap | Request body for update cost center

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

### Parameters

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

### Return type

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