Calling GraphQL api in Mendix

2
Good day I’m new on Mendix and trying to integrate my  GraphQL service and Mendix application. Does Mendix supports GraphQL? i cannot seem to find tutorials/ blogs on this topic, Please help.
asked
4 answers
3

Here’s an example how to use “Call REST” Activity for an GraphQL API. It uses a small custom java action (GraphQL query template 2 JSON) to transform a GraphQL query into a JSON query that can be Posted to a GraphQL endpoint.

 

 

answered
1

You can call a GraphQL endpoint in the same way you’d call a regular REST endpoint. However, at this point Mendix doesn’t offer any assistance in building GraphQL queries, so you’d have to create the request body yourself and parse the response accordingly.

answered
0

To add some more detail, the first screenshot shows an example of how you can do a GraphQL query in visual studio code with the rest plugin. GraphQL query on the left, the result HTTP call on the right. Notice that the graphql query needs to be rewritten into a valid json payload. The second example is the quick and dirty java demo code that does this for simple situations. Note that this is not extensively tested, and not fit for production…

 

 

answered
0

Hi, just realized that I missed a basic step. I realized that I forgot to set a new HTTP header for Content-Type. Now getting the response.

answered