Glue API: Retrieve measurement units

Edit on GitHub

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

Request sample: retrieve a measurement unit

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

Response

Response sample: retrieve a measurement unit

{
    "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 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—Manage 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—Manage 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

CODE REASON
3401 No product measurement unit code was specified.
3402 Product measurement unit with the specified code was not found.

To view generic errors that originate from the Glue Application, see Reference information: GlueApplication errors.