Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for independently creating/modifying product images. #88

Closed
gavinballard opened this issue Feb 22, 2015 · 3 comments
Closed

Support for independently creating/modifying product images. #88

gavinballard opened this issue Feb 22, 2015 · 3 comments

Comments

@gavinballard
Copy link
Contributor

Please correct me if I'm wrong, but at the moment the only way to create/update product images through the Python API is directly through a POST/PUT call to the product endpoint.

As per the Shopify API documentation on product images, we should be able to make POST and PUT calls directly to /admin/products/#{id}/images.json and PUT /admin/products/#{id}/images/#{id}.json. However, this doesn't seem to work currently with the API as the prefix for the Image class isn't properly being built. Thus, something like this...

image = shopify.Image()
image.src = "http://example.com/example.png"
image.product_id = 123456789
image.save()

... tries to POST to /admin/products//images.json which returns a 406.

Looking at the source, I think a fix would be to implement the prefix() class method, similar to what's been done with the Variant class. Just wanted to run this by folks who might be more familiar with this to see if that might be a valid solution.

@kevinhughes27
Copy link
Contributor

that sounds like the correct approach to me.

@gavinballard
Copy link
Contributor Author

Cool, thanks for the feedback. I have a workaround in place for the moment but when I find the time I'll fix this up and shoot through a PR.

@kevinhughes27
Copy link
Contributor

np thanks for helping out!

asiviero added a commit to asiviero/shopify_python_api that referenced this issue Aug 18, 2015
asiviero added a commit to asiviero/shopify_python_api that referenced this issue Aug 18, 2015
kevinhughes27 added a commit that referenced this issue Nov 26, 2015
Support for independently creating/modifying product images (closes #88)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants