Unexpected / undocumented response when result contains only 1 resource

Hi there,

Not sure if this is the correct place for a support ticket. Please redirect me to wherever is more appropriate o:) .

The retail REST api responds with a list of resources. However when only 1 result is found, the resource is not in a list but the map of the resource itself.

Example: https://api.lightspeedapp.com/API/Account/xxx/Vendor.json?limit=1

Note: the limit 1 is just for demonstration. This also happens in any other circumstance where the response contains 1 resource.

Expected result

{
    "count": "345",
    "offset": "0",
    "limit": "1"
  },
  "Vendor": [{
    "vendorID": "1",
    "name": "Label Noir",
    "archived": "false",
    "accountNumber": "",
    "priceLevel": "",
    "updatePrice": "false",
    "updateCost": "false",
    "updateDescription": "false",
    "shareSellThrough": "false",
    "timeStamp": "2017-08-04T11:38:31+00:00"
  }]
}

Actual result

{
    "count": "345",
    "offset": "0",
    "limit": "1"
  },
  "Vendor": {
    "vendorID": "1",
    "name": "Label Noir",
    "archived": "false",
    "accountNumber": "",
    "priceLevel": "",
    "updatePrice": "false",
    "updateCost": "false",
    "updateDescription": "false",
    "shareSellThrough": "false",
    "timeStamp": "2017-08-04T11:38:31+00:00"
  }
}

Context

Not a problem for me since I know about this and have updated my client of the API. I'm merely submitting this in case the Lightspeed developers were not yet aware of this. I also didn't find any other discussions about this on this forum. Again please redirect me somewhere more appropriate.

Probable cause

Speculating: probably due to a conversion between xml and json somewhere deeper in your stack.

Greetings,

Yann 


3 comments

Sign In or Register to comment.