Solved

Best way to format GraphQL Payloads


Badge

I’m working with a few different GraphQL endpoints where are becoming much more common it seems in B2B applicaitons.

 

While GraphQL still uses just REST, formatting payloads in Arc is a bit difficult other than just using plain text and script port:

For example:
https://shopify.dev/docs/api/admin-graphql/unstable/queries/order?language=cURL
 


GraphQL looks like:
 

query {
node(id: "gid://shopify/Order/148977776") {
id
... on Order {
name
}
}
}

 

but to support this in Arc, I need to use a script port with a string of:
 

{"query": "query { node(id: "gid://shopify/Order/148977776") { id ... on Order { name } } }

Which fair enough is simple for my example, but realistic GraphQL queries are much more complex. Any suggestions on how to potentially work with this format in Arc?
 

icon

Best answer by James B 10 May 2024, 14:56

View original

2 replies

Userlevel 6
Badge

Unfortunately, we do not offer native support for GraphQL connections in CData Arc at this time. 

 

It does, however, look like you are trying to integrate with Shopify, which is supported in a dedicated Shopify connector: 

 

https://cdn.cdata.com/help/AZK/mft/Shopify.html

This connector supports integration with Shopify through the CData driver of the same name, and maps tables to the different Shopify endpoints. Are you able to use this connector to communicate with Shopify instead?

Badge

Ok thanks understood, in this example with Shopify, new mutations are only available in GraphQL.

We’ll continue to use as we are now with script ports and use ArcScript to remove new lines and format the request body for REST.

 

PS, that is just one example where they are creating new endpoints only through GraphQL but a few others include:

Reply