Retrieving measurement units
  • 15 Oct 2020
  • 1 Minute To Read
  • Print
  • Share
  • Dark
    Light

Retrieving measurement units

  • Print
  • Share
  • Dark
    Light

The Measurement Units API together with the Measurement Units feature allows selling products in any measurement units configured in your shop.

Installation

For detailed information on the modules that provide the API functionality and related installation instructions, see Glue API: Measurement Units Feature Integration.

Retrieve a measurement unit

To retrieve measurement unit information by product measurement unit code, send the request:


GET /product-measurement-units/{{product_measurement_unit_code}}


Path parameter Description
{{product_measurement_unit_code}} Code of a measurement unit to get information for.

Request

Sample request: GET http://glue.mysprykershop.com/product-measurement-unit/METR

Response

Response sample:

{
    "data": {
        "type": "product-measurement-units",
        "id": "METR",
        "attributes": {
            "name": "Meter",
            "defaultPrecision": 100
        },
        "links": {
            "self": "http://glue.mysprykershop.com/product-measurement-units/METR"
        }
    }
}

Attribute Type Description
name string Name of the product measurement unit.
defaultPrecision integer The default ratio between a sales unit and a base unit. It is used when precision for a related sales unit is not specified.
measurementUnitCode string Code of the measurement unit.

Other management options

You can use the measurement units resource as follows:

  • Retrieve information about a concrete product, including all the measurement units defined for it - Retrieve Concrete Products.
  • Retrieve sales unit of a product - Retrieve Sales Units
  • Add items to carts and retrieve information about them with the amount of cart items defined in product measurement units - Managing Carts of Registered Users.
  • Add items to guest carts and retrieve information about them with the amount of cart items defined in product measurement units - Managing Guest Carts.
  • Retrieve information about items in an order with the amount of order items defined in product measurement units - Retrieving an Order.

Possible errors

Status Description
400 No product measurement unit code was specified.
404 Product measurement unit with the specified code does not exist.
Was This Article Helpful?