GraphQL Mutation in Mendix

0
I am looking for an example that explains hitting a GraphQL server with Mutation request in mendix. I am hitting the server using callRESTService Activity in Microflows. There are four options to for constructing request Body in the activity - i found none of them is suitable to dynamic construction of the Mutation . Can anyone help me with this.
asked
3 answers
0

If you set the operation to POST, you should be able to provide a custom request template. You can use a string variable here, which can contain any GraphQL mutation request you need.

 

image.png

answered
0

Example with export mapping. The following microflow builds a list of 2 configurations, uses an export mapping to convert it to json and then uses rest call to call a dummy rest http endpoint:

 

image.png

 

Domain model and message definition:

 

image.png

 

Export mapping:

 

image.png

 

Export mapping activity to generate json from list:

 

image.png

 

Rest call with the Graphql payload:

 

image.png

 

You probably need additional info in the query, probably easiest to handle in the export mapping.

answered
0

Hi! I am working on exchanges between Mendix and CRM by using GraphQL. We can expect something from Mendix in the futur to offer a clean and easy way to integrate this kind of exchanges. But, for now, the fastest way is using JSON directly (that s means a java action) to be able to build the JSON structure, especially if you use variables because you will never be able to build your request directly with Mendix without knowing, per advance, what will be the JSON structure (mapping is not possible when you don t know what will be key-value pairs and also the data type / number, string, boolean).

 

If you work only with simple queries, you can use the default JSON export mapping provided by Mendix. 

 

answered