Jump to content

Upload image: can't get JSON response


Lluiso

Recommended Posts

When I successfully upload an image using PS webservice ('POST' myshop.com/api/images/products) the response is the image itself. I would like to have a JSON response so that I can use the image ID.
I have tried to add `output_format=JSON` to the query string and adding the "Accept: application/json" header, to no avail.

Is there a way to have a JSON response when uploading an image?

Link to comment
Share on other sites

  • 2 months later...
On 2/27/2025 at 5:13 PM, Lluiso said:

When I successfully upload an image using PS webservice ('POST' myshop.com/api/images/products) the response is the image itself. I would like to have a JSON response so that I can use the image ID.
I have tried to add `output_format=JSON` to the query string and adding the "Accept: application/json" header, to no avail.

Is there a way to have a JSON response when uploading an image?

The /api/images/products endpoint in PrestaShop does not return JSON by default. If you want to get image metadata in JSON, then you need to send the product ID in the API. Like this: /api/products/ID_PRODUCT

This will also return XML by default. To request JSON, you need to add "output_format=JSON"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...