Back to Aligni.com

GET /api/v2/:api_token/unit
List units.

Retrieve the list of all units.

Examples

# request
curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' \
https://demo.aligni.com/api/v2/oid3vLgynoy_Yl1gZkrgkLEq3J/unit

# response
<units>
  <unit>
    <id>2</id>
    <name>each</name>
    <description></description>
  </unit>
  <unit>
    ...
  </unit>
</units>

Params

Param name Description
api_token
required

Your API token.


Value: Must be a String

GET /api/v2/:api_token/unit/:id
Show a unit.

Retrieve one particular unit by its id.

Examples

# request
curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' \
https://demo.aligni.com/api/v2/oid3vLgynoy_Yl1gZkrgkLEq3J/unit/2

# response
<?xml version="1.0" encoding="UTF-8"?>
<unit>
  <id>3</id>
  <name>inch</name>
  <description>US inch</description>
  <allow_fractional>true</allow_fractional>
  <unit_conversions>
    <unit_conversion>
      <id>6</id>
      <to_unit_id>3</to_unit_id>
      <factor>12.0</factor>
    </unit_conversion>
    ...
  </unit_conversions>
</unit>

Params

Param name Description
api_token
required

Your API token.


Value: Must be a String
id
required

Value: Must be a number.

POST /api/v2/:api_token/unit
Create a new unit.

Also see show action for detailed XML unit response example.

Create a new unit.

Examples

# request
curl -X POST -H 'Accept: application/xml' -H 'Content-Type: application/xml' -d "
<unit>
  <name>per box</name>
  <description>one box</description>
</unit>" \
https://demo.aligni.com/api/v2/oid3vLgynoy_Yl1gZkrgkLEq3J/unit

# response (for detailed unit XML see show action)
<unit>
  ...
</unit>

Params

Param name Description
api_token
required

Your API token.


Value: Must be a String

PUT /api/v2/:api_token/unit/:id
Update a unit.

Also see show action for detailed XML unit response example.

Updates a unit record.

Examples

# request
curl -X PUT -H 'Accept: application/xml' -H 'Content-Type: application/xml' -d "
<unit>
  <name>per small box</name>
  <description>one small box</description>
</unit>" \
https://demo.aligni.com/api/v2/oid3vLgynoy_Yl1gZkrgkLEq3J/unit/14

# response (for detailed unit XML see show action)
<unit>
  ...
</unit>

Params

Param name Description
api_token
required

Your API token.


Value: Must be a String
id
required

Value: Must be a number.

DELETE /api/v2/:api_token/unit/:id
Delete a unit.

Delete a unit by its id.

Examples

# request
curl -X DELETE -H 'Accept: application/xml' -H 'Content-Type: application/xml' \
https://demo.aligni.com/api/v2/oid3vLgynoy_Yl1gZkrgkLEq3J/unit/14

# no response

Params

Param name Description
api_token
required

Your API token.


Value: Must be a String
id
required

Value: Must be a number.