hope you are doing well !
I have been trying to write a GraphQL Mutation Resolver for a REST POST request in Azure APIM but nothing is working so far.
The REST call takes an object with firstName, lastName, username, password and returns an object with the same fields.
Below is my current code. Any Help would be appreciated.
<set-graphql-resolver parent-type="Mutation" field="createUser">
<http-data-source>
<http-request>
<set-method>POST</set-method>
<set-url>[URL]</set-url>
<set-header name="Content-Type" exists-action="override">
<value>application/json</value>
</set-header>
<set-body>@{
var args = context.Request.Body.As<JObject>(true)["arguments"];
JObject jsonObject = new JObject();
jsonObject.Add("firstName", args["firstName"]);
jsonObject.Add("lastName", args["lastName"]);
jsonObject.Add("username", args["username"]);
jsonObject.Add("password", args["password"]);
return jsonObject.ToString();
}</set-body>
</http-request>
</http-data-source>
</set-graphql-resolver>
UPDATE:
This is the schema i am using:
And this is how i am testing the mutation with the arguments and the original error i am getting:
In Application insights, i am getting this error log:
NOTE: This is the original response that i'm getting from a normal REST Request
Thank you!
I contacted Microsoft about this issue and they told me that it is a bug on the service side. The product team is working on the fix and it will be released in v.33 (4 to 6 weeks).