GET

Description

Retrieves a list of cost centers or a single cost center.

URL structure

https://api.fortnox.se/3/costcenters/{Code}

Method

GET

Version

3

Response

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.

<?xml version="1.0" encoding="UTF-8"?>
<CostCenters TotalResources="11" TotalPages="1" CurrentPage="1">
  <CostCenterSubset url="https://api.fortnox.se/3/costcenters/K1">
    <Code>K1</Code>
    <Description>Kassa 1</Description>
    <Note></Note>
    <Active>true</Active>
  </CostCenterSubset>

  [...]

  <CostCenterSubset url="https://api.fortnox.se/3/costcenters/K2">
    <Code>K2</Code>
    <Description>Kassa 2</Description>
    <Note></Note>
    <Active>false</Active>
  </CostCenterSubset>
</CostCenters>
<?xml version="1.0" encoding="UTF-8"?>
<CostCenter url="https://api.fortnox.se/3/costcenters/K1">
  <Code>K1</Code>
  <Description>Kassa 1</Description>
  <Note></Note>
  <Active>true</Active>
</CostCenter>
{
  "MetaInformation": {
    "@TotalResources": 11,
    "@TotalPages": 1,
    "@CurrentPage": 1
  },
  "CostCenters": [
    {
      "@url": "https://api.fortnox.se/3/costcenters/K1",
      "Code": "K1",
      "Description": "Kassa 1",
      "Note": null,
      "Active": true
    },

    [...]

    {
      "@url": "https://api.fortnox.se/3/costcenters/K2",
      "Code": "K2",
      "Description": "Kassa 2",
      "Note": null,
      "Active": false
    }
  ]
}
{
  "CostCenter": {
    "@url": "https://api.fortnox.se/3/costcenters/K1",
    "Code": "K1",
    "Description": "Kassa 1",
    "Note": null,
    "Active": true
  }
}

POST

Description

Creates a cost center.

URL structure

https://api.fortnox.se/3/costcenters

Method

POST

Version

3

Request

The request body should contain a structure of a cost center, either in JSON or XML.

<CostCenter>
  <Code>K3</Code>
  <Description>Kassa 3</Description>
</CostCenter>
{
  "CostCenter": {
    "Code": "K3",
    "Description":"Kassa 3"
  }
}

Response

The response should contain the created cost center in either JSON or XML.

<?xml version="1.0" encoding="UTF-8"?>
<CostCenter url="https://api.fortnox.se/3/costcenters/K3">
  <Code>K3</Code>
  <Description>Kassa 3</Description>
  <Note></Note>
  <Active>true</Active>
</CostCenter>
{
  "CostCenter": {
    "@url": "https://api.fortnox.se/3/costcenters/K3",
    "Code": "K3",
    "Description": "Kassa 3",
    "Note": null,
    "Active": true
  }
}

PUT

Description

Updates a cost center.

URL structure

https://api.fortnox.se/3/costcenters/{Code}

Method

PUT

Version

3

Request

The request body should contain a structure of a cost center, either in JSON or XML.

<CostCenter>
  <Code>K3</Code>
  <Description>Kassa 3</Description>
  <Active>false</Active>
</CostCenter>
{
  "CostCenter": {
    "Code": "K3",
    "Description":"Kassa 3",
    "Active": false
  }
}

Response

The response should contain the updated cost center in either JSON or XML.

<?xml version="1.0" encoding="UTF-8"?>
<CostCenter url="https://api.fortnox.se/3/costcenters/K3">
  <Code>K3</Code>
  <Description>Kassa 3</Description>
  <Note></Note>
  <Active>false</Active>
</CostCenter>
{
  "CostCenter": {
    "@url": "https://api.fortnox.se/3/costcenters/K3",
    "Code": "K3",
    "Description": "Kassa 3",
    "Note": null,
    "Active": false
  }
}

DELETE

Description

Removes a cost center.

URL structure

https://api.fortnox.se/3/costcenters/{Code}

Method

DELETE

Version

3

Request

The request body should be empty.

Response

The response body should be empty.

Fields

Field Description Limits Type Searchable Sortable Required R/W
Url Direct URL to the record String R
Code The code of the cost center String Yes Yes R/W*
Description The description of the cost center String Yes R/W
Note The note of the cost center String R/W
Active If the cost center is active or not Boolean R/W

* Only writable during POST.