All URIs are relative to http://localhost, except if the operation defines another base path.
Method | HTTP request | Description |
---|---|---|
createCostCentersResource() | POST /3/costcenters | Create a cost center |
getCostCentersResource() | GET /3/costcenters/{Code} | Retrieve a single cost center |
listCostCentersResource() | GET /3/costcenters | Retrieve a list of cost centers |
removeCostCentersResource() | DELETE /3/costcenters/{Code} | Remove a cost center |
updateCostCentersResource() | PUT /3/costcenters/{Code} | Update a cost center |
createCostCentersResource($cost_center): \FortnoxApi\Model\CostCenterWrap
Create a cost center
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new FortnoxApi\Api\CostCentersResourceApi(
// 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 \FortnoxApi\Model\CostCenterWrap(); // \FortnoxApi\Model\CostCenterWrap | cost center to create
try {
$result = $apiInstance->createCostCentersResource($cost_center);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling CostCentersResourceApi->createCostCentersResource: ', $e->getMessage(), PHP_EOL;
}
Name | Type | Description | Notes |
---|---|---|---|
cost_center | \FortnoxApi\Model\CostCenterWrap | cost center to create | [optional] |
\FortnoxApi\Model\CostCenterWrap
No authorization required
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
getCostCentersResource($code): \FortnoxApi\Model\CostCenterWrap
Retrieve a single cost center
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new FortnoxApi\Api\CostCentersResourceApi(
// 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->getCostCentersResource($code);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling CostCentersResourceApi->getCostCentersResource: ', $e->getMessage(), PHP_EOL;
}
Name | Type | Description | Notes |
---|---|---|---|
code | string | identifies the cost center |
\FortnoxApi\Model\CostCenterWrap
No authorization required
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
listCostCentersResource(): \FortnoxApi\Model\CostCenterList
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.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new FortnoxApi\Api\CostCentersResourceApi(
// 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->listCostCentersResource();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling CostCentersResourceApi->listCostCentersResource: ', $e->getMessage(), PHP_EOL;
}
This endpoint does not need any parameter.
\FortnoxApi\Model\CostCenterList
No authorization required
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
removeCostCentersResource($code)
Remove a cost center
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new FortnoxApi\Api\CostCentersResourceApi(
// 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->removeCostCentersResource($code);
} catch (Exception $e) {
echo 'Exception when calling CostCentersResourceApi->removeCostCentersResource: ', $e->getMessage(), PHP_EOL;
}
Name | Type | Description | Notes |
---|---|---|---|
code | string | identifies the cost center to remove |
void (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
updateCostCentersResource($code, $cost_center): \FortnoxApi\Model\CostCenterWrap
Update a cost center
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new FortnoxApi\Api\CostCentersResourceApi(
// 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 \FortnoxApi\Model\CostCenterWrap(); // \FortnoxApi\Model\CostCenterWrap | cost center to update
try {
$result = $apiInstance->updateCostCentersResource($code, $cost_center);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling CostCentersResourceApi->updateCostCentersResource: ', $e->getMessage(), PHP_EOL;
}
Name | Type | Description | Notes |
---|---|---|---|
code | string | identifies the cost center | |
cost_center | \FortnoxApi\Model\CostCenterWrap | cost center to update | [optional] |
\FortnoxApi\Model\CostCenterWrap
No authorization required
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]