POST request with ACE - getting 415 JWT

I am trying to call the search issue rest as a post and keep getting 415. get requests works fine. Not sure what I’m doing wrong.
Thanks!

const clientKey = req.context.clientKey;
        const httpClient = addon.httpClient({
            clientKey: clientKey,            
        });

httpClient.post({url:URL},(err, response, body) => {
          if (err || response.statusCode < 200 || response.statusCode >= 300) reject (err || body);
          resolve(body);
        })

415 means unsupported media type - perhaps you need to set a content-type header of application/json

1 Like

Thanks! that did the trick.

httpClient.post({
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
},
url: url,
body: data,
}
, (err, response, body) => {
if (err || response.statusCode < 200 || response.statusCode >= 300) reject(err || body);
resolve(JSON.parse(body));
})
1 Like