Have your say in Community Polls: What was/is your greatest motivation to start your own business?
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.

How to make Asset API work with custom app?

How to make Asset API work with custom app?

Vietnguyen09
Shopify Partner
3 0 0

Hello,

I'm trying to work with the assets API (https://shopify.dev/docs/api/admin-rest/2024-04/resources/asset) but cannot get it to work. I installed a development app with the write_themes scope granted in my store not using the public app, but somehow, when I send a PUT request to create a new JSON theme file, it never creates a new theme file. How can you guys get this to work?

 

Here is what I call the API on Postman.

Screenshot 2024-07-01 221939.png

 

Thanks for your help.

Replies 2 (2)

Liam
Community Manager
3108 344 893

Hi Vietnguyen09,

 

That's strange as it looks like you're receiving back a 200 response that indicates the API call was successful. If you try to upload a file instead of defining a value for the file, (eg: adding a image to the /assets directory) do you see the file appearing? 

Liam | Developer Advocate @ 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

Vietnguyen09
Shopify Partner
3 0 0

Thank you for your attention to my problem. I found a solution. In the image above, I used my own domain instead of the myshopify domain, and it didn't work. When I changed it to xxx.myshopify.com/admin..., it worked well. I guess there is an issue when the Shopify system forwards the header/post data from my domain to the myshopify domain.