This same exact call seems to be working fine in the Python SDK. Is there something I should be doing different?
My request looks like:
const client = new Client({
environment: Environment.Sandbox,
accessToken: "myAPIKey",
})
export const getCoffeeOfferings = async () => {
try {
const response = await client.catalogApi.searchCatalogItems({});
console.log(response.result);
} catch(error) {
console.log(error);
}
}
My response looks like:
request: {
method: 'POST',
url: 'https://connect.squareupsandbox.com/v2/catalog/search-catalog-items',
headers: {
'user-agent': 'Square-TypeScript-SDK/13.1.0',
'content-type': 'application/json',
authorization: 'Bearer myAPIkey',
'Square-Version': '2021-08-18',
accept: 'application/json'
},
body: { type: 'text', content: '{}' }
},
statusCode: 400,
headers: {
'content-type': 'application/json',
'square-version': '2021-08-18',
vary: 'Origin, Accept-Encoding',
'x-content-type-options': 'nosniff',
'x-download-options': 'noopen',
'x-frame-options': 'SAMEORIGIN',
'x-permitted-cross-domain-policies': 'none',
'x-speleo-traceid': 'SFTaWdKWDXeFY',
'x-xss-protection': '1; mode=block',
date: 'Thu, 09 Sep 2021 23:39:47 GMT',
'content-length': '172',
'strict-transport-security': 'max-age=631152000; includeSubDomains; preload',
connection: 'close'
},
body: '{"errors":[{"category":"INVALID_REQUEST_ERROR","code":"BAD_REQUEST","detail":"Value is expected to be map[string]interface {}, but received string (line 1, character 4)"}]}',
result: [Object: null prototype] { errors: [ [Object: null prototype] ] },
errors: [
[Object: null prototype] {
category: 'INVALID_REQUEST_ERROR',
code: 'BAD_REQUEST',
detail: 'Value is expected to be map[string]interface {}, but received string (line 1, character 4)'
}
]
}