Hi everyone,
I’m trying to call the asset search API: /api/v2/asset?search
, but I always get the following error:
{
status: 500,
headers: {
date: 'Thu, 19 Sep 2024 10:39:06 GMT',
'content-type': 'application/json',
'transfer-encoding': 'chunked',
connection: 'close',
status: '500 Internal Server Error',
'strict-transport-security': 'max-age=63072000; includeSubDomains',
'x-freshservice-api-version': 'latest=v2; requested=v2',
'x-request-id': 'c2ec60bc-b2ad-9247-b676-9811ff7fc2c1',
'x-envoy-upstream-service-time': '88',
'x-fw-ratelimiting-managed': 'true',
'x-ratelimit-total': '500',
'x-ratelimit-remaining': '499',
'x-ratelimit-used-currentrequest': '1',
'x-trace-id': '00-f21ae6cc40c312af7aa32367d8ac105b-bcdc85f0ca1248ba-01',
nel: '{ "report_to": "nel-endpoint-freshservice", "max_age": 2592000, "include_subdomains": true}',
'report-to': '{ "group": "nel-endpoint-freshservice", "max_age": 2592000, "include_subdomains": true, "endpoints": [{"url": "https://edge-admin.eu-central-1.freshedge.net/nelreports/freshservice"}]}',
server: 'fwe'
},
response: `{"code":"internal_error","message":"We're sorry, but something went wrong."}`,
attempts: 1,
errorSource: 'APP'
}
Here’s my code. I’ve hardcoded values in requests.json
to reduce potential errors:
server.js :
$request.invokeTemplate('viewAsset', {}).then(function (data) {
console.log("viewAsset:",data);
},
function (error) {
console.error("viewAsset",error);
});
requests.json :
"viewAsset": {
"schema": {
"method": "GET",
"host": "mydomainfreshservice.com",
"path": "/api/v2/asset?search=name%3A%27TEST%27",
"headers": {
"Authorization": "Basic <%= encode('hardcodedapikey') %>",
"Content-Type": "application/json"
}
}
}
Any ideas on what could be going wrong or here I can find details about the error?
Thanks
Geoffroy