How to use an endpoint with url parameters in Hasura actions #9346
-
I am at the moment trying to convert an endpoint like https://example.com/check?param1=value1 to graphql with Actions. To fill value1, I want to use an input from an input type as I configured in the type configuration. I am unable to find any examples online using this format. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @Tristangva If I am correct, this - https://example.com/check would be your webhook/action handler for your action right ? Request URL transformAcc. to your use case, you can use "Request URL" transform in your action. Reference - https://hasura.io/docs/latest/actions/rest-connectors/#request-url So if you want to have See attached screenshot So your GraphQL mutation would look like mutation MyMutation {
testAction(arg1: {value: "value123"}) {
name
}
} where testAction is my action. And upon hitting your endpoint, in your backend, it will have Is this what you were trying to achieve ? Like Passing value, supplied from gql mutation to your custom param ? Or I might be wrong in understanding your use-case, so do let us know, thanks ! |
Beta Was this translation helpful? Give feedback.
Hey @Tristangva
If I am correct, this - https://example.com/check would be your webhook/action handler for your action right ?
Request URL transform
Acc. to your use case, you can use "Request URL" transform in your action. Reference - https://hasura.io/docs/latest/actions/rest-connectors/#request-url
So if you want to have
param1
to have value supplied from your request's body input sayarg1
, you can supply query param under "Change Request Options" section while creating action via console.See attached screenshot
So your GraphQL mutation would look like
where testAction is my action. And upon hitting your e…