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

roelvanreeroelvanree Posts: 3Member
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:

2018-04-24
Ship Instructions
Stock Instructions
1
1


This is the end-point I am calling:
https://api.merchantos.com/API/Account/123456/Order.json

Any help is appreciated.

Best regards Roel.
Post edited by roelvanree on
Tags:

2 comments

  • roelvanreeroelvanree Posts: 3Member
    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="http://xxx.com/LightSpeedCreateOrderHeaderRequest">
    <orderedDate> 2018-04-24</orderedDate>
    <shipInstructions>Ship Instructions</shipInstructions>
    <stockInstruction>Stock Instructions</stockInstruction>
    <vendorID>1</vendorID>
    <shopID>1</shopID>
    </root>
  • jamesratcliffejamesratcliffe Posts: 160Administrator, Lightspeed Staff moderator
    @roelvanree The error is telling you that the root element name should be "Order".
    <Order>
    <orderedDate>2018-04-24</orderedDate>
    <shipInstructions>Ship Instructions</shipInstructions>
    <stockInstruction>Stock Instructions</stockInstruction>
    <vendorID>1</vendorID>
    <shopID>1</shopID>
    </Order>
    James Ratcliffe
    API Integrations Specialist
    Lightspeed HQ
Sign In or Register to comment.