[SLAPI] Specifying a result limit of 1 makes collection APIs not return an array
renier opened this issue · 0 comments
renier commented
Summary
Passing a resultLimit parameter of 1
to any collection API changes the type of the structure containing the response.
https://api.softlayer.com/rest/v3/SoftLayer_Account/getUsers.json
returns multiple users as an array.
But, https://api.softlayer.com/rest/v3/SoftLayer_Account/getUsers.json?resultLimit=1
returns the single JSON object.
This is unexpected and confusing to strict-type clients parsing SLAPI responses.
Expected behavior
Collection APIs always return an array, even if there is only a single object contained due to the resultLimit.
Workaround
For colleciton APIs, look at the response text and add []
around it if they are not present.