Skip to content

How do request a list of available collections? #162

Answered by vincentsarago
tylere asked this question in Q&A
Discussion options

You must be logged in to vote

@tylere in the latest release 1.3.0 I've added 2 debugs endpoints /collections and /collections/{collection_id}

@app.get("/collections", include_in_schema=False, tags=["DEBUG"])
async def list_collections(request: Request):
"""list collections."""
with request.app.state.dbpool.connection() as conn:
with conn.cursor(row_factory=dict_row) as cursor:
cursor.execute("SELECT * FROM pgstac.all_collections();")
r = cursor.fetchone()
cols = r.get("all_collections", [])
return [col["id"] for col in cols]
@app.get("/collections/{collection_id}", include_in_schema=False, tags=

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by tylere
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants