product import

WiglWagl
New Member
9 0 0

Hi,

why does this curl not work?

curl -X POST https:...myshop.com/products.json --data '{"product":{"title":"BurtonCustomFreestyle151","body_html":"Goodsnowboard","vendor":"Burton","product_type":"Snowboard","images":[{"src":"http://example.com/rails_logo.gif"}]}}'

with postman it works?

Thanks
King regards
R

 

0 Likes
Greg_Kujawa
Shopify Partner
937 79 201

What response are you getting back with the curl request? And how are you passing along your credentials with the curl request? Compare that against Postman and therein lies the difference!

0 Likes
WiglWagl
New Member
9 0 0

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

0 Likes
Greg_Kujawa
Shopify Partner
937 79 201

You don't appear to be specifying the Content-Type in the curl call. 

-H 'Content-Type: application/json'

 

0 Likes
WiglWagl
New Member
9 0 0

Thanks a lot but same error also with  "-H 'Content-Type: application/json'"

 

Thaknsbest regards

R

0 Likes
Greg_Kujawa
Shopify Partner
937 79 201

If you can fire up Fiddler you can see exactly what is being passed out of the Postman session as well as the curl session. Likely to do with the body payload's quotes and whatnot I'm guessing...

0 Likes
Greg_Kujawa
Shopify Partner
937 79 201

I have curl for Windows and the statement below worked just fine. Of course redacted the API creds in the URL.

curl -X POST "https://{api_key}:{api_secret}@diamond-cellar.myshopify.com/admin/products.json" -H "Content-Type: application/json" -d  "{\"product\":{\"title\":\"BurtonCustomFreestyle151\",\"body_html\":\"Goodsnowboard\",\"vendor\":\"Burton\",\"product_type\":\"Snowboard\",\"images\":[{\"src\":\"https://twitter.com/rails/status/689480911432249345/photo/1\"}]}}"