Square’s API Reference site is a little bit confusing as everything is listed in snake_case, but the API’s (node.js specifically) actually use camelCase. Is there a reason for this?
Also, there is one example in the node.js API where it fails on camelCase and expects snake_case.
try {
const response = await client.loyaltyApi.searchLoyaltyAccounts({
query: {
customer_ids : ['abcde'] // Only works with snake_case, not camelCase
},
limit: 5
});
console.log(response.result);
} catch(error) {
console.log(error);
Sorry yes, the responses in our reference are all in JSON. We’re constantly working to improve our features based on feedback like this, so I’ll be sure to share your request to the API product team.
Yes, this has been brought up. There currently isn’t a wrapper in the SDK that can parse webhook payloads and transform them to camel case. We’re constantly working to improve our features based on feedback like this, so I’ll be sure to share your request to the API product team.