on 04-08-2020 12:04 PM
Hello SAP community,
I have a question to submit.
We are using CAP to reach an API from ApiManagement hosted on Neo.
Our model is defined in package.json as follow"cds":{
"requires : {
"orders": {
"kind": "odata",
"model": "srv/external/OrdersMetadata.json",
"credentials": {
"APIKey": <API_KEY> <--- we tried here
"requestTimeout": 10000,
"destination": "dest_orders"
},
"pool": {
"min": 1,
"max": 10
}
}
}
}
We tried while working locally for now to provide the credentials (APIKey) in destination defined in a default-env.jsonfile
{
"name": "dest_orders",
"url": "https://<API_MANAGEMENT_DEST>/v0/orderTracking",
"headers": {
"APIKey": <API_KEY> <--- and we tried here
}
}
but so far we are getting a 401 unauthorized and this error :
{ fault:
{
faultstring: 'Failed to resolve API Key variable request.header.APIKey',
detail: { errorcode: 'steps.oauth.v2.FailedToResolveAPIKey' }
}
}
So our guess is that APIKey is not forwarded with the request but we cannot find how to send the APIKey with the request.
Hi,
setting headers is supported with the next release (approximately end of August). Please check the documentation here:
https://github.wdf.sap.corp/pages/cap/node.js/api#srv-emit
const tx = service.transaction()
const resultUsingHeaders = await tx.emit({ query: SELECT.from('Entity'), headers: { header1: 'content' } })
Best regards
Samuel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Samuel,
please be aware that this is an external forum and the external link is:
https://cap.cloud.sap/docs/node.js/api#srv-emit
Best regards
Gregor
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.