List all units

GET /api/units
<?xml version="1.0" encoding="UTF-8"?>
<units type="array" page="1" per_page="100" total="2">
    <unit>
        ...
    </unit>
    <unit>
        ...
    </unit>
</units>

The list can be filtered with parameters:

GET /api/units?name=hour

Shows all units with the term “hour” in their name. It doesn’t matter if you use upper– or lowercase.
The following parameters can be used:

Parameter Description
name Name of the unit

Show a specific unit

GET /api/units/{id}
<?xml version="1.0" encoding="UTF-8"?>
<unit>
    <id type="integer">1</id>
    <created type="datetime">2007-12-13T12:12:00+01:00</created>
    <name>hour</name>
</unit>

Create unit

POST /api/units
XML element Description Type Default value Mandatory
name Name of the unit ALNUM yes
<unit>
    <name>Piece</name>
</unit>
<?xml version="1.0" encoding="UTF-8"?>
<unit>
    <id type="integer">1234</id>
    <created type="datetime">2007-12-13T12:12:00+01:00</created>
    <name>Piece</name>
</unit>

Edit unit

PUT /api/units/{id}
<unit>
    <name>pallets</name>
</unit>

Delete unit

DELETE /api/units/{id}

You cannot delete units while they are assigned to any articles.