What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

script tag adding issue

script tag adding issue

Victor_DS
Visitor
1 0 0

Hey everyone. there is some trouble with adding script tags
trying to add script tag using curl according to documentation
example:
curl -d '{"script_tag":{"event":"onload","src":"https://cdn.shopify.com/s/files/1/0593/4458/4892/files/test.js?v=1632817403"}}' \
-X POST "https://crossing-minds-store.myshopify.com/admin/api/2021-07/script_tags.json" \
-H "X-Shopify-Access-Token: [REDACTED]"
example2 using node js :
{"errors":{"script_tag":"Required parameter missing or invalid"}}
const data = await client.post({
path: 'script_tags',
body: { "script_tag": { "event": "onload", "src": "https://cdn.shopify.com/s/files/1/0593/4458/4892/files/test.js?v=1632817403" } },
type: DataType.JSON,
});
Received an error response (400 Bad Request) from Shopify a046fc80-db6f-4cad-b658-c260ab05a3fc

Reply 1 (1)

awwdam
Shopify Staff
249 42 38

Hey @Victor_DS, I tested this functionality with no issue using both cURL and an api client, then took a closer look at the info shared info shared. From now, I would suggest some additional testing using our examples here, as well as with multiple supported versions to confirm if the issue persists across each. Eg. 2021-07 and 2021-10.  

If you continue to get the same error, please feel free to share any x-request-id headers returned back with me here, and I would be happy to pass on insights moving forward - Cheers!

awwdam | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog