6 months ago
I'm trying to use the GraphQL API for getting deployments information. I'm having a hard time figuring out how to specify the "before" and "after" date values in order to filter the response by a specific date range. I've tried a standard ISO date string and some other variations.
This works (without "before" and "after" variables set):
curl --location 'https://backboard.railway.app/graphql/v2' \
--header 'Content-Type: application/json' \
--header 'Authorization: °°°°°°°°°° \
--data '{"query":"query deployments($after: String, $before: String, $first: Int, $input: DeploymentListInput!, $last: Int) {\n deployments(\n after: $after\n before: $before\n first: $first\n input: $input\n last: $last\n ) {\n __typename\n edges {\n node {\n createdAt\n status\n meta\n }\n }\n }\n}","variables":{"first":8,"input":{"projectId":"°°°°°°°°°°","environmentId":"°°°°°°°°°°","serviceId":"°°°°°°°°°°"}}}'
But if I try adding the "before" variable in an ISO format it doesn't work:
curl --location 'https://backboard.railway.app/graphql/v2' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer °°°°°°°°°°' \
--data '{"query":"query deployments($after: String, $before: String, $first: Int, $input: DeploymentListInput!, $last: Int) {\n deployments(\n after: $after\n before: $before\n first: $first\n input: $input\n last: $last\n ) {\n __typename\n edges {\n node {\n createdAt\n status\n meta\n }\n }\n }\n}","variables":{"first":8,"before":"2024-11-27T23:36:38.418Z","input":{"projectId":"°°°°°°°°°°","environmentId":"°°°°°°°°°°","serviceId":"°°°°°°°°°°"}}}'
This is the response I get, which is not specific enough for me to figure out what went wrong:
{"errors":[{"message":"Problem processing request","traceId":"3844069342004704628"}],"data":null}
I've also tried a unix timestamp as the value.
3 Replies
6 months ago
Hello,before
and after
are not timestamps, they are cursor locations.
You will need to add pageInfo
to your GQL call to get the cursors -
pageInfo {
hasNextPage
endCursor
}
Status changed to Awaiting User Response railway[bot] • 6 months ago
6 months ago
That explains it. @brody, thanks for the clarification!
Status changed to Awaiting Railway Response railway[bot] • 6 months ago
Status changed to Awaiting User Response railway[bot] • 6 months ago
Status changed to Solved brody • 6 months ago