0

I am trying to make a function to make a call in graphql to my shopify site via zoho flow with a deluge function my code works but I have the impression that the deluge poses certain problems in my code

Thank you for your help

headers = Map();
headers.put("X-Shopify-Access-Token",v_AccessToken);
headers.put("Content-Type","application/json");
// Construire dynamiquement le corps de la requête GraphQL
query = "{ companies(first: 1, query: \"external_id:'" + externalId + "'\") { edges { node { id name defaultRole { id name } contacts(first: 1, query: \"email:" + email + "\") { edges { node { id title isMainContact customer { id lastName firstName email } __typename } } } locations(first: 1) { nodes { id name catalogs(first: 1) { nodes { title } } } } } } }";
body = "{\"query\": \"{" + query + "}\"}";
// Requête GraphQL à Shopify
response = postUrl("https://dev-speechi-partenaire.myshopify.com/admin/api/2024-07/graphql.json",{"headers":headers,"body":body});
// Convertir la réponse en map
response_map = response.toMap();
// Affichage de la réponse complète de l'API
info response_map;
}

I'm looking to find a solution to make this code work in deluge

1 Answer 1

0

It is recommended to use invoke URL, since postURL will be deprecated.

See below a working example, you can adjust to your query needs.

query = {
    "query": "{ shop { name } }" 
};

query_json = query.toString();

get_shopify_shop_name = invokeurl 
[ 
url : "https://dev-speechi-partenaire.myshopify.com/admin/api/2024-07/graphql.json" 
type :POST 
content-type: "application/json"  
parameters :query_json 
connection :"shopify"

];

info get_shopify_shop_name;

In your code I see you are not using connections, I highly recommend it, as it is more secured and saves a lot of development time.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.