Create a parcel line item

How to create a parcel line item via API

To create a new parcel line item, send a POST request to the /api/parcel_line_items endpoint, passing the resource arguments in the request body.

Request

POST https://yourdomain.commercelayer.io/api/parcel_line_items

Arguments

Body ParameterTypeRequired

type

string

Required

attributes.quantity

integer

Required

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

relationships.parcel

object

Required

relationships.stock_line_item

object

Required

Example

The following request creates a new parcel line item:

curl -g -X POST \
  'https://yourdomain.commercelayer.io/api/parcel_line_items' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "parcel_line_items",
    "attributes": {
      "quantity": 4
    },
    "relationships": {
      "parcel": {
        "data": {
          "type": "parcels",
          "id": "ABCRtyUpBa"
        }
      },
      "stock_line_item": {
        "data": {
          "type": "stock_line_items",
          "id": "BCDRtyUpBa"
        }
      }
    }
  }
}'

Last updated