Must be passed as a JSON-encoded array. Solution

ericabizericabiz Member Posts: 2

This one took me forever to figure out, and should be documented in the official API docs since they suggest to use cURL.

[ and ] are invalid characters in a URL. The cURL wrapper that languages like PHP use automatically and silently get rid of them. So when Lightspeed asks you to create a request like:\["Contact"\]&!~,

This request is going to fail. Lightspeed will respond with 400 Bad Request "load_relations must be passed as a JSON encoded array."

The solution? Encode JUST the [ ] characters and remove the escape backslashes:


This will fix the issue.

For some reason, this isn't documented anywhere. Lightspeed, please add this to your documentation. It would have saved me so much time today. (I finally found the solution here:!topic/merchantos-api-developers/9CDhGkSSp7U -- in an obscure old mailing list post.)

Sign In or Register to comment.