NutraSoft food manufacturing ERP software
Esc
  • GuideGetting startedThree steps to your first call and your first order, then the two shapes every response takes.
  • GuideAuthentication and keysBearer keys, test and live environments, rotation without an outage, and what each scope grants.
  • GuideTest modeA second NutraSoft account of your own, seeded with realistic data, that you can safely break.
  • PageErrorsEvery error code the API returns, what it means, what to do about it and whether to retry.
  • PageConventionsThe rules every operation follows: money, time, paging, sorting, nulls, PATCH and identifiers.
Menu

Units of measure

The units products and operations are counted in, yours plus the shared reference set.

catalog:readcatalog:writehttps://public-api.nutrasoft.ca/v1

The Unit of measure object

  • idinteger
  • codestring

    Short code, unique within an account.

  • is_globalboolean

    True for a shared unit, false for one your account created.

  • namestringnullable
  • read_onlyboolean

    A NutraSoft-supplied unit your account may use but not change.

  • weight_in_gramsnumbernullable

    Grams per one of this unit; 0 or null for a unit that is not a weight.

Operations

List units of measure

get/units-of-measurecatalog:read

Your units plus the shared ones, marked is_global. Units with read_only true cannot be changed or deleted.

Query parameters

  • searchstringnullable

    Free-text match on name or code.

  • sortstringnullable

    Comma-separated field:direction pairs, e.g. id:desc. Sortable: code, id, name. id is always added last, so paging is stable.

  • limitinteger

    Rows to return. Maximum 200.

    • >= 1
    • <= 200
    • default 50
  • offsetinteger

    Rows to skip. Maximum 10000: to read further, narrow the filters or page with updated_since.

    • >= 0
    • <= 10000
    • default 0
Returns
200 A page of UnitOfMeasure objects in data, with pagination.
Errors
400 401 403 429 500 503
GET /units-of-measure
curl "https://public-api.nutrasoft.ca/v1/units-of-measure?limit=50" \
  -H "Authorization: Bearer $NUTRASOFT_API_KEY"
Response200
{
  "data": [
    {
      "id": 123,
      "code": "SAMPLE-01",
      "is_global": false,
      "name": "Sample name",
      "read_only": false,
      "weight_in_grams": 12.5
    }
  ],
  "pagination": {
    "limit": 50,
    "offset": 0,
    "total": 1,
    "has_more": false
  },
  "order": "id:asc"
}

Retrieve a unit of measure

get/units-of-measure/{uom_id}catalog:read

Path parameters

  • uom_idintegerrequired

    The unit's id.

    • > 0
Returns
200 One UnitOfMeasure object in data.
Errors
400 401 403 404 429 500 503
GET /units-of-measure/{uom_id}
curl "https://public-api.nutrasoft.ca/v1/units-of-measure/123" \
  -H "Authorization: Bearer $NUTRASOFT_API_KEY"
Response200
{
  "data": {
    "id": 123,
    "code": "SAMPLE-01",
    "is_global": false,
    "name": "Sample name",
    "read_only": false,
    "weight_in_grams": 12.5
  }
}

Create a unit of measure

post/units-of-measurecatalog:write

The code must not already be used by one of your units or a shared one; a duplicate is a 409.

Request body

  • codestringrequired

    Short code, unique among your units and the shared ones.

    • min 1 chars
    • max 40 chars
  • namestringrequired
    • min 1 chars
    • max 100 chars
  • weight_in_gramsnumberrequired

    Grams per one of this unit. Send 0 for a unit that is not a weight.

    • >= 0
Returns
201 One UnitOfMeasure object in data.
Errors
400 401 403 409 429 500 503
POST /units-of-measure
curl -X POST "https://public-api.nutrasoft.ca/v1/units-of-measure" \
  -H "Authorization: Bearer $NUTRASOFT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "code": "SAMPLE-01",
  "name": "Sample name",
  "weight_in_grams": 12.5
}'
Response201
{
  "data": {
    "id": 123,
    "code": "SAMPLE-01",
    "is_global": false,
    "name": "Sample name",
    "read_only": false,
    "weight_in_grams": 12.5
  }
}

Update a unit of measure

patch/units-of-measure/{uom_id}catalog:write

Omitted fields are left unchanged and the code cannot be changed. Shared and read_only units are read-only (403).

Path parameters

  • uom_idintegerrequired

    The unit's id.

    • > 0

Request body

  • namestringnullable
    • min 1 chars
    • max 100 chars
  • weight_in_gramsnumbernullable
    • >= 0
Returns
200 One UnitOfMeasure object in data.
Errors
400 401 403 404 409 429 500 503
PATCH /units-of-measure/{uom_id}
curl -X PATCH "https://public-api.nutrasoft.ca/v1/units-of-measure/123" \
  -H "Authorization: Bearer $NUTRASOFT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Sample name"
}'
Response200
{
  "data": {
    "id": 123,
    "code": "SAMPLE-01",
    "is_global": false,
    "name": "Sample name",
    "read_only": false,
    "weight_in_grams": 12.5
  }
}

Delete a unit of measure

delete/units-of-measure/{uom_id}catalog:write

Refused with 409 while a product, lot or document uses the unit. Shared and read_only units are read-only (403).

Path parameters

  • uom_idintegerrequired

    The unit's id.

    • > 0
Returns
200 One UnitOfMeasure object in data.
Errors
400 401 403 404 409 429 500 503
DELETE /units-of-measure/{uom_id}
curl -X DELETE "https://public-api.nutrasoft.ca/v1/units-of-measure/123" \
  -H "Authorization: Bearer $NUTRASOFT_API_KEY"
Response200
{
  "data": {
    "id": 123,
    "code": "SAMPLE-01",
    "is_global": false,
    "name": "Sample name",
    "read_only": false,
    "weight_in_grams": 12.5
  }
}