Jump to content

500 Internal Server Error on Webservice API (JSON output & Order Status update)


Jay Chauhan

Recommended Posts

Hello,
I am facing two main issues with the PrestaShop Webservice API while running PrestaShop in Docker container (local environment).
 

1. Authentication API with JSON format

  • When I call the API with output_format=JSON, it returns 500 Internal Server Error.
  • The same request works fine with XML format.
  • Example request (API key hidden for security):
     
    Quote

    curl --location 'http://localhost:8080/api?output_format=JSON' \
    --header 'Authorization: Basic <API_KEY>'

     

  • Response: 500 Internal Server Error
  • Logs show no additional info (please guide where to check deeper logs if needed).
     

2. Updating Order Status

  • My order flow is:
  • Current status: Authorized
  • I successfully updated to: Processing in Progress
  • Next, when I try to update to: Shipped → I get 500 Internal Server Error.
  • Same sequence works correctly when changing statuses inside the Back Office.
  • API Request (simplified, key hidden):
     
    Quote

    curl -X PUT 'http://localhost:8080/api/orders/ORDER_ID' \
    -H 'Authorization: Basic <API_KEY>' \
    -H 'Content-Type: application/xml' \
    -d '<prestashop>...<current_state><![CDATA[4]]></current_state>...</prestashop>'

     

  • Question: Is there a predefined sequence of allowed order status changes in the API?
  • Or is this a bug with the Webservice, since the same transitions work in Back Office?
     

Steps to Reproduce

  1. Run PrestaShop in Docker (local mode).
  2. Create an order (status = Authorized).
  3. Use API to change status → Processing in Progress (works).
  4. Use API again to change status → Shipped (fails with 500).
  5. Try API call with output_format=JSON → also fails with 500.

Environment

  • PrestaShop Version: 9
  • Running in: Docker image (local)
  • Mode: Developer

Questions:

  1. Why does the API fail with output_format=JSON while XML works?
  2. Is there a required/predefined sequence of order status transitions when using the API (different from Back Office)?
     

Thank you in advance 🙏

Edited by Jay Chauhan (see edit history)
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...