Can I cancel orders in bulk?

Yes, you can! Please follow the instructions:

The Orders API supports two bulk order cancel methods:

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

Bulk Cancel queued Orders

You can cancel all of your "queued" orders by POST-ing 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 will include a count of orders which were successfully concelled, or which failed to cancel.

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

Note: Because of the asynchronous nature of the Planet's ordering system, some of the orders in a "queued" state at the time of the request may transition to a "running" state as we service the request and may no longer be cancellable. As such, we cannot guarantee that all 100% of orders "queued" at the time of the request will be successfully cancelled.

Bulk Cancel Specified Orders

You can cancel a set of orders orders by POST-ing 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 successfully cancel.

 

For more information, please visit: https://developers.planet.com/docs/orders/ordering/

 

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

Comments

0 comments

Please sign in to leave a comment.