You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to query a rest endpoint and pass variables as query string, for example /api/resource?arg1=true&arg2=false... From looking at the docs I assume the recommended way is to use pathBuilder however there is no example or clear documentation of how to use it properly.
I've looked at the following issues and PRs to try to get more info: #70 #39 #160
However I still don't get pathBuilder is supposed to be used.
Could you point me to an explanation or example of how to query endpoints that have query string parameters. I'll be happy to submit a PR to update the docs once I figure this out.
I also posted a question on SO, with more details about my particular use case.
Thanks!
The text was updated successfully, but these errors were encountered:
Hey @Lavielle you shouldn't need to use the pathBuilder for simple query params. You can pass your variables directly into your path like so:
queryQueryAliasAndVariableDeclerations($fieldId: String!$startDate: String!$endDate: String!){// make sure you pass along the above variables into the query itself.gqlQuery(fieldId: $fieldId,startDate: $startDate,endDate: $endDate)
@rest(type: "FieldSurveysDataPayload"path: "/api/field/{args.fieldId}?start_date={args.startDate}&end_date={args.endDate}"method: "GET"){// ... your expected response }}
I'm trying to query a rest endpoint and pass variables as query string, for example
/api/resource?arg1=true&arg2=false...
From looking at the docs I assume the recommended way is to usepathBuilder
however there is no example or clear documentation of how to use it properly.I've looked at the following issues and PRs to try to get more info:
#70
#39
#160
However I still don't get
pathBuilder
is supposed to be used.Could you point me to an explanation or example of how to query endpoints that have query string parameters. I'll be happy to submit a PR to update the docs once I figure this out.
I also posted a question on SO, with more details about my particular use case.
Thanks!
The text was updated successfully, but these errors were encountered: