Units of Measure

The system uses units of measure to count output from activities. Examples include feet, inches, meters, gallons.

Prerequisites

There are no prerequisites for creating units of measure.

Example

In this example, we create, verify, update, and delete a unit of measure.

Create a unit of measure

The create request:

  • creates a new unit of measure named: Feet
  • defines the abbreviated name as: Ft.
  • defines this unit of measure as active

Example request

Call the Create Unit of Measure POST /v1/work/units_of_measure operation with the following request payload.

{
  "abbreviatedName": "Ft.",
  "active": true,
  "name": "Feet",
  "version": 1
}

Example response

A success response returns HTTP status code 200 and a response body similar to the following example.

{
    "id": 1,
    "name": "Feet",
    "abbreviatedName": "Ft.",
    "version": 1,
    "active": true
}

Verify

To verify, call the Retrieve Unit of Measure by ID GET /v1/work/units_of_measure/{id} or the Retrieve All Units of Measure or by Name GET /v1/work/units_of_measure?name={name} operation.

Calling GET /v1/work/units_of_measure/1 or GET /v1/work/units_of_measure?name=Feet returns:

{
    "id": 1,
    "name": "Feet",
    "abbreviatedName": "Ft.",
    "version": 1,
    "active": true
}

Note: Calling the Retrieve All Units of Measure or by Name GET /v1/work/units_of_measure?name=Feet operation returns the object above enclosed in an array, since omitting the name query parameter returns all units of measure in the system.

Update the unit of measure

To update the unit of measure by changing the abbreviated name, call the Update Unit of Measure by ID PUT /v1/work/units_of_measure/1 operation with the following request payload.

Example request

{
    "id": 1,
    "name": "Feet",
    "abbreviatedName": "Ft",
    "version": 1,
    "active": true
}

Example response

{
    "id": 1,
    "name": "Feet",
    "abbreviatedName": "Ft",
    "version": 2,
    "active": true
}

Note that the version is automatically incremented to 2. To successfully update this unit of measure again, you must pass version 2 in the request body.

Delete the unit of measure

To delete this unit of measure, call the Delete Unit of Measure by ID DELETE /v1/work/units_of_measure/{id} operation.

The system returns HTTP status 204 with an empty response body.