Skip to content

hotfix: support all subscriptions api results endpoint query parameters#1209

Open
asonnenschein wants to merge 3 commits intomainfrom
hotfix/subs-results-query-params
Open

hotfix: support all subscriptions api results endpoint query parameters#1209
asonnenschein wants to merge 3 commits intomainfrom
hotfix/subs-results-query-params

Conversation

@asonnenschein
Copy link
Contributor

Summary

Adds missing query parameters (created, updated, completed, user_id) to Subscriptions API results endpoints, aligning with the OpenAPI specification.

Changes

  • Async Client (planet/clients/subscriptions.py): Added 4 query parameters to get_results() and get_results_csv() with comprehensive docstrings
  • Sync Client (planet/sync/subscriptions.py): Updated to accept and forward new parameters
  • CLI (planet/cli/subscriptions.py): Added --created, --updated, --completed, --user-id options to results command
  • Documentation (docs/cli/cli-subscriptions.md): Added "Filtering Results" section with examples

All datetime parameters support RFC 3339 format with date-times, closed intervals, and open intervals.

Example Usage

Python:

pl.subscriptions.get_results(                                                                                                                                        
    subscription_id="...",                                                                                                                                           
    completed="2024-01-01T00:00:00Z/..",                                                                                                                             
    user_id="all"                                                                                                                                                    
)                                                                                                                                                                    
                                                                                                                                                                     
CLI:                                                                                                                                                                 
planet subscriptions results SUBSCRIPTION_ID \
    --completed 2024-01-01T00:00:00Z/.. \                                                                                                                            
    --user-id all  

Copy link
Contributor

@tbarsballe tbarsballe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One issue noted inline, aside from that it appears to work well.
I did get some unhelpful error messages when I messed up the time interval syntax, but that's more an issue with the Subscriptions API itself, so out-of-scope here.

% planet subscriptions results 3ad50be0-05ea-4a1c-82cc-1e288211e627 --created 2026-03-07/..
Error: {"error":{"reason":"Unexpected error","details":[]}}

* `--created`: Filter results by creation time or an interval of creation times.
* `--updated`: Filter results by update time or an interval of update times.
* `--completed`: Filter results by completion time or an interval of completion times.
* `--user-id`: Filter by user ID. Only available to organization admins. Accepts "all" or a specific user ID.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The most useful of the supported properties, item_datetime, appears to be missing.

Seems like this wasn't included in the TODO, but it is in the API reference

I'll also note user_id is not included as a supported option in the API reference for getResults, so I don't think it is correct to include here. I believe (at least according to the documentation) it is only supported at the "subscriptions list" level (which the SDK does already support)

@click.option(
'--completed',
help="""Filter results by completion time or interval. See documentation
for examples.""")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth including RFC 3339 in the help message? That way people who are familiar don't have to fall back to the documentation. Or do you think that would just add more confusion for those who aren't.

Whatever you feel is best ... I'm thinking probably just leave this as-is, but figured it's at least worth considering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants