Calling Order API gives me error response "Bad Request" with code = 400

roelvanreeroelvanree Member Posts: 3
edited May 2018 in Development
Hi, I call the Purchase Order (Header) API and I get this error back from the server:
"XML object name (root) does not match the endpoint type (Order)" with response code = 400

Since there are no XSD provided by LightSpeed I can never be 100% sure my structure meets their structure. I based my structure on the example message send in the POST to the end-point.

This is the complete message:
<?xml version="1.0"?>
400Bad RequestXML object name (root) does not match the endpoint type (Order).Exception

This is the request I POST to the end-point:

Ship Instructions
Stock Instructions

This is the end-point I am calling:

Any help is appreciated.

Best regards Roel.
Post edited by roelvanree on


  • roelvanreeroelvanree Member Posts: 3
    Something went wrong in the post of my message...
    Internally my structure is XML. When it's send to LightSpeed it's transformed into JSON. Below is the structure in XML:

    <root xmlns="">
    <orderedDate> 2018-04-24</orderedDate>
    <shipInstructions>Ship Instructions</shipInstructions>
    <stockInstruction>Stock Instructions</stockInstruction>
  • jamesratcliffejamesratcliffe Administrator, Lightspeed Staff Posts: 160 moderator
    @roelvanree The error is telling you that the root element name should be "Order".
    <shipInstructions>Ship Instructions</shipInstructions>
    <stockInstruction>Stock Instructions</stockInstruction>
    James Ratcliffe
    Lightspeed HQ
Sign In or Register to comment.