Can I cancel orders in bulk?

Yes. The Orders API supports two bulk-cancel methods:

  1. Bulk cancel all queued orders
  2. Bulk cancel a specified list of order_ids

Bulk cancel queued orders

To cancel all of your queued orders, POST an empty JSON object ({}) to https://api.planet.com/compute/ops/bulk/orders/v2/cancel.

Example request:

POST https://api.planet.com/compute/ops/bulk/orders/v2/cancel
{}

Example response: The response includes a count of orders that were successfully canceled and any that failed to cancel.

{
  "result": {
    "failed": {
      "count": 0,
      "failures": []
    },
    "succeeded": {
      "count": 6
    }
  }
}

Note: Because of the asynchronous nature of the Planet ordering system, some orders in a queued state at the time of the request might transition to a running state and become non-cancellable. Planet cannot guarantee that 100% of queued orders are canceled.

Bulk cancel specified orders

To cancel a specific set of orders, POST an array of order_ids to https://api.planet.com/compute/ops/bulk/orders/v2/cancel.

Example request:

POST https://api.planet.com/compute/ops/bulk/orders/v2/cancel
{
   "order_ids": [
      "6031093e-90b7-4a94-9eb6-f3e5ca976a78",
      "dd2e95fa-a4bb-447f-93a1-44fe0ba80d3d",
      "04cf3dff-1774-4b2b-888d-a090de15023e",
      "08989bf2-8d9c-44d7-8b7d-f23d89ae2be9",
      "afe85e41-170f-40eb-8c98-c511e0814604",
      "34de3a40-ae7a-4904-abea-3aaf64f79e99"
   ]
}

Example response:

{
  "result": {
    "failed": {
      "count": 2,
      "failures": [
        {
          "message": "Order not in a cancellable state",
          "order_id": "afe85e41-170f-40eb-8c98-c511e0814604"
        },
        {
          "message": "Order not in a cancellable state",
          "order_id": "34de3a40-ae7a-4904-abea-3aaf64f79e99"
        }
      ]
    },
    "succeeded": {
      "count": 4
    }
  }
}

In the response above, two of the six orders failed to cancel.

For more information, see Orders API ordering documentation.

Replacement for: Can I cancel orders in bulk?

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.