Where can I find a list of all API urls which I ca...
# ask-community
c
Where can I find a list of all API urls which I can access with
prefect.client.client.Client.get
?
For reference, I'm trying to hit he following without success:
Copy code
[2021-01-14 16:00:00.000] ERROR    --- 400 Client Error: Bad Request for url: <https://api.prefect.io/flows?name=dbt_test>
Traceback (most recent call last):
  File "deploy/register_flows.py", line 491, in <module>
    main()
  File "deploy/register_flows.py", line 485, in main
    create_proj_and_register_flows(flows, args)
  File "deploy/register_flows.py", line 278, in create_proj_and_register_flows
    register_flow(flow, flow_file, args)
  File "deploy/register_flows.py", line 314, in register_flow
    flow_already_registered(flow.name)
  File "deploy/register_flows.py", line 319, in flow_already_registered
    resp = CLIENT.get('flows', params={"name": flow_name})
  File "/Users/constantino.schillebeekx/.pyenv/versions/dwh/lib/python3.8/site-packages/prefect/client/client.py", line 406, in get
    response = self._request(
  File "/Users/constantino.schillebeekx/.pyenv/versions/dwh/lib/python3.8/site-packages/prefect/client/client.py", line 710, in _request
    response = self._send_request(
  File "/Users/constantino.schillebeekx/.pyenv/versions/dwh/lib/python3.8/site-packages/prefect/client/client.py", line 620, in _send_request
    response.raise_for_status()
  File "/Users/constantino.schillebeekx/.pyenv/versions/dwh/lib/python3.8/site-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: <https://api.prefect.io/flows?name=dbt_test>
k
I don’t know immediately as people normally use the GraphQL and
client.graphql()
or the other methods ont he Client
c
Hi @Constantino Schillebeeckx - it appears you are attempting to query the API as if it were a REST API, but the Prefect API is a GraphQL API. This means GraphQL queries are written and sent as the request body, and all requests are sent as POST requests -- as @Kevin Kho mentioned the way to achieve your expected query is:
Copy code
query = """query{flow(where: {name: {_eq: "dbt_test"}}){name id ...}}""" # list other attributes you are looking for here

client.graphql(query)
upvote 1
1