GraphQL Update Product Status (using Oracle Package)

Solved

GraphQL Update Product Status (using Oracle Package)

utsmitty
Visitor
2 1 0

I am trying to migrate from the REST API over to the GraphQL. We are running everything on a Oracle server using UTL_HTTP.  I need to update a status to Archived for duplicate products. Currently I just  keep getting the following error and have rebuilt the payload every way we can think of. If anyone can see anything that might help, please let us know, and thanks in advance.  

 

{"errors":{"query":"Required parameter missing or invalid"}}

 

The package (for the most part) is below:

    G_URL := 'https://############.myshopify.com/admin/api/2025-04/graphql.json';
    G_TOKEN := '######################################';
P_PRODUCT_ID := '###############'; G_PAYLOAD := '{' || '"query": "mutation ProductUpdate($input: ProductInput!) { productUpdate(input: $input) { product { id status } userErrors { field message } } }",' || '"variables":{' || '"input":{' || '"id":"gid://shopify/Product/' || P_PRODUCT_ID || '",' || '"status":"ARCHIVED"' || '}' || '}' || '}'; G_REQ := UTL_HTTP.begin_request( url => G_URL, method => 'POST', http_version => 'HTTP/1.1' ); UTL_HTTP.set_header(G_REQ, 'Content-Type', 'application/json'); UTL_HTTP.set_header(G_REQ, 'X-Shopify-Access-Token', G_TOKEN);

UTL_HTTP.write_text(G_REQ, G_PAYLOAD);
G_RESP := UTL_HTTP.GET_RESPONSE(G_REQ);

Thanks 

Accepted Solution (1)

utsmitty
Visitor
2 1 0

This is an accepted solution.

well found the issue, have to send a content length header. Added the following to the set_header stack and it works:

 

UTL_HTTP.set_header(G_REQ, 'Content-Length', TO_CHAR(DBMS_LOB.GETLENGTH(G_PAYLOAD)));

View solution in original post

Reply 1 (1)

utsmitty
Visitor
2 1 0

This is an accepted solution.

well found the issue, have to send a content length header. Added the following to the set_header stack and it works:

 

UTL_HTTP.set_header(G_REQ, 'Content-Length', TO_CHAR(DBMS_LOB.GETLENGTH(G_PAYLOAD)));