GET

Description

Retrieves a list of units or a single unit.

URL structure

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

Method

GET

Version

3

Response

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.

<?xml version="1.0" encoding="UTF-8"?>
<Units TotalResources="5" TotalPages="1" CurrentPage="1">
  <UnitSubset url="https://api.fortnox.se/3/units/h">
    <Code>h</Code>
    <Description>timmar</Description>
  </UnitSubset>

  [...]

  <UnitSubset url="https://api.fortnox.se/3/units/st">
    <Code>st</Code>
    <Description>styck</Description>
  </UnitSubset>
</Units>
<?xml version="1.0" encoding="UTF-8"?>
<Unit url="https://api.fortnox.se/3/units/h">
  <Code>h</Code>
  <Description>timmar</Description>
</Unit>
{
  "MetaInformation": {
    "@TotalResources": 5,
    "@TotalPages": 1,
    "@CurrentPage": 1
  },
  "Units": [
    {
      "@url": "https://api.fortnox.se/3/units/h",
      "Code": "h",
      "Description": "timmar"
    },

    [...]

    {
      "@url": "https://api.fortnox.se/3/units/st",
      "Code": "st",
      "Description": "styck"
    }
  ]
}
{
  "Unit": {
    "@url": "https://api.fortnox.se/3/units/h",
    "Code": "h",
    "Description": "timmar"
  }
}

POST

Description

Creates a unit.

URL structure

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

Method

POST

Version

3

Request

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

<Unit>
  <Code>m</Code>
  <Description>meter</Description>
</Unit>
{
  "Unit": {
    "Code": "m",
    "Description": "meter"
  }
}

Response

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

<?xml version="1.0" encoding="UTF-8"?>
<Unit url="https://api.fortnox.se/3/units/m">
  <Code>m</Code>
  <Description>meter</Description>
</Unit>
{
  "Unit": {
    "@url": "https://api.fortnox.se/3/units/m",
    "Code": "m",
    "Description": "meter"
  }
}

PUT

Description

Updates a unit.

URL structure

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

Method

PUT

Version

3

Request

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

<Unit>
  <Code>m</Code>
  <Description>Meter</Description>
</Unit>
{
  "Unit": {
    "Code": "m",
    "Description": "Meter"
  }
}

Response

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

<?xml version="1.0" encoding="UTF-8"?>
<Unit url="https://api.fortnox.se/3/units/m">
  <Code>m</Code>
  <Description>Meter</Description>
</Unit>
{
  "Unit": {
    "@url": "https://api.fortnox.se/3/units/m",
    "Code": "m",
    "Description": "Meter"
  }
}

DELETE

Description

Removes a unit.

URL structure

https://api.fortnox.se/3/units/{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 unit String Yes R/W*
Description The description of the unit String R/W

* Only writable during POST.