Solved

how to see all orders?

  • 25 January 2024
  • 3 replies
  • 119 views

Badge +2

I created >100 orders using automatic scripts, but I can only retrieve 20 of them, the last 20. How can I see the rest of them? 

 

I get 20 orders both via the python Order API and the web browser….

icon

Best answer by Miguel Castro Gomez 22 February 2024, 09:57

View original

3 replies

Badge +4

Hi @AndreaMelchiorre,

When did you create those orders? Please, be aware that with the Orders API, you can get a list of all orders created within the last three months

For reference, have a look to the documentation of the Orders API here

Badge +2

I created >7000 in a 5 days more or less, so they should be all there, unless there is a maximum number of orders kept in each account history.

I realized the Python API allows me to go through the pages and see them all but

 

  • I was not able to expand the page size
  • on browser, I only see the 20 orders, and there is no button to go to the next page

Thank you

Badge +4

Hi @AndreaMelchiorre,

Regarding the volume of orders you are creating, be aware that each organization can keep up to 10,000 orders total in the queue. (more info here)


To make sure you can paginate over all your orders, I have added below an example on how to request the full list of orders linked to your account. Changing the default number of orders per page is not possible. Also, you could filter your orders based on their status (see the example here). 
 

import os
import requests
import time

# Set your API Key
PLANET_API_KEY = ‘Add your API KEY’

# Set the URL for Orders APIs
orders_api_url = "https://api.planet.com/compute/ops/orders/v2"

# Create a session and set the headers with the API key
session = requests.Session()
session.auth = (PLANET_API_KEY, "")

# Get a list of all your orders, using the API pagination

# Get initial list of orders
response = session.get(orders_api_url)
orders_list = response.json()
all_orders = orders_list["orders"]

# Go over pages to capture all orders
while "_links" in orders_list and "next" in orders_list["_links"]:
    next_response = session.get(orders_list["_links"]["next"])
    orders_list = next_response.json()
    all_orders += orders_list["orders"]
    time.sleep(1)


print(f"Total number of orders: {len(all_orders)} \n")

You should be able now to explore the all_orders list to see the details of each one.

About the browser, as you scroll down, the list should expand showing you all available orders. 

Regards,

Miguel

Reply


Planet Monitoring
Investors

© 2024 Planet Labs PBC. All rights reserved.
| Privacy Policy | California Privacy Notice | California Do Not Sell
Your Privacy Choices | Cookie Notice | Terms of Use