Order Item Units

Fetching list of order item units.

LIST

Return a collection of order item units.

Example of fetching order item units list

Request

GET /order-item-units HTTP/1.1

Response

{
	"data": [
		{
			"id": 1,
			"external_identifier": "P-123",
			"external_reference": "P-123",
			"merchant": 1,
			"order": 1,
			"order_item": 1,
			"merchant_variant": 100,
			"id_tag": 1,
			"state": "pending",
			"created_at": "2023-02-07T13:17:06+00:00",
			"updated_at": "2023-02-07T13:17:06+00:00"
		},
		{
			"id": 2,
			"external_identifier": null,
			"external_reference": null,
			"merchant": 1,
			"order": 2,
			"order_item": 2,
			"merchant_variant": 200,
			"id_tag": 2,
			"state": "pending",
			"created_at": "2023-02-07T13:17:06+00:00",
			"updated_at": "2023-02-07T13:17:06+00:00"
		},
        .......
	],
	"links": {
		"first": null,
		"last": null,
		"prev": null,
		"next": "https://api.smake.io/master-administration/order-item-units?cursor=eyJvcmRlcnMuaWQiOjQ2LCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9"
	},
	"meta": {
		"path": "https://api.smake.io/master-administration/order-item-units",
		"per_page": 15,
		"next_cursor": "eyJvcmRlcnMuaWQiOjQ2LCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9",
		"prev_cursor": null
	}
}

GET

Returns a order item unit of given id = x.

Example of fetching specified order item unit information

Request

GET /order-item-units/1 HTTP/1.1

Response

{
    "id": 1,
    "external_identifier": "P-123",
    "external_reference": "P-123",
    "merchant": 1,
    "order": 1,
    "order_item": 1,
    "merchant_variant": 100,
    "id_tag": 1,
    "state": "pending",
    "created_at": "2023-02-07T13:17:06+00:00",
    "updated_at": "2023-02-07T13:17:06+00:00"
}

Filtering

You can filter your results as follows:

List order item units for specified external reference

  • /order-item-units?filter[external_reference]=P-123

List order item units for order item id

  • /order-item-units?filter[order_item]=1

List order item units for order item external identifier

  • /order-item-units?filter[order_item.external_identifier]=P-123

List order item units for order id

  • /order-item-units?filter[order]=1

List order item units for state

  • /order-item-units?filter[state]=confirmed

Expand relation

To get a expanded relations please take a look into Expanding objects.

Allowed expansion merchant_variant, merchant_variant.master_variant, id_tag

Example of expanded relation

Request

GET /order-item-units/1?expand=id_tag HTTP/1.1

Response

{
    "id": 1,
    "external_reference": "P-123",
    "merchant": 1,
    "order": 1,
    "order_item": 1,
    "merchant_variant": 100,
    "id_tag": {
		"id": 1,
		"order_item_unit": 1,
		"media": [],
		"created_at": "2023-02-07T13:17:06+00:00",
		"updated_at": "2023-02-07T13:17:06+00:00"
	},
    "state": "pending",
    "created_at": "2023-02-07T13:17:06+00:00",
    "updated_at": "2023-02-07T13:17:06+00:00"
}

Cancel

Cancels a order item unit of given id = x.

Example of canceling order item units

Request

PUT /order-item-units/1/cancel HTTP/1.1

Response

{
    "id": 1,
    "external_identifier": "P-123",
    "external_reference": "P-123",
    "merchant": 1,
    "order": 1,
    "order_item": 1,
    "merchant_variant": 100,
    "id_tag": 1,
    "state": "cancelled",
    "created_at": "2023-02-07T13:17:06+00:00",
    "updated_at": "2023-02-07T13:17:06+00:00"
}