Create a return line item

How to create a return line item via API

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

Request

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

Arguments

Body ParameterTypeRequired

type

string

Required

attributes.quantity

integer

Required

attributes.return_reason

object

Optional

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

relationships.return

object

Required

relationships.line_item

object

Required

Example

The following request creates a new return line item:

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

Last updated