Create an order copy

How to create an order copy via API

To create a new order copy, send a POST request to the /api/order_copies endpoint, passing the resource arguments in the request body.

Request

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

Arguments

Body ParameterTypeRequired

type

string

Required

attributes.place_target_order

boolean

Optional

attributes.reuse_wallet

boolean

Optional, default is 'true'

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

attributes.cancel_source_order

boolean

Optional

attributes.apply_promotions

boolean

Optional, default is 'false'

attributes.ignore_invalid_coupon

boolean

Optional, default is 'false'

relationships.source_order

object

Required

Example

The following request creates a new order copy:

curl -g -X POST \
  'https://yourdomain.commercelayer.io/api/order_copies' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "order_copies",
    "relationships": {
      "source_order": {
        "data": {
          "type": "orders",
          "id": "ABCRtyUpBa"
        }
      }
    }
  }
}'

Last updated