Trying to use permid file match and receive error Failed to resolve API Key variable request.head...

...er.X-AG-Access-Token
Good day
I am trying to use permID file match by hitting https://api.thomsonreuters.com/permid/match/file
I can use the entity search API with no errors, but with the file match I am getting the following error
{
"fault": {
"faultstring": "Failed to resolve API Key variable request.header.X-AG-Access-Token",
"detail": {
"errorcode": "steps.oauth.v2.FailedToResolveAPIKey"
}
}
}
I am currently using postman to test and am unsure of what I am doing wrong.
When using this access token in the Dev Tools try it out section, I do not receive an error.
Any help is appreciated.
Steven
Best Answer
-
I have modified the code.
1. The path should start with "/"
2. Add the "x-ag-access-token" in the headers
3. Add content in the body
The modified code is:
var http = require("https");
var options = { "method": "POST", "hostname": "api.thomsonreuters.com", "path": "/permid/match/file", "headers": { "content-type": "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW", "x-openmatch-numberOfMatchesPerRecord": "1", "x-openmatch-dataType": "Organization", "cache-control": "no-cache", "Postman-Token": "101e3dbe-96bf-4b1c-9fce-8dad5f4ff975", "x-ag-access-token" : "token"}};
var req = http.request(options, function (res) { var chunks = []; res.on("data", function (chunk) { chunks.push(chunk); });
res.on("end", function () { var body = Buffer.concat(chunks); console.log(body.toString()); }); });
req.write("------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"; filename=\"test.csv\"\r\nContent-Type: application/vnd.ms.-excel\r\n\r\nLocalID,Standard Identifier,Name,Country,Street,City,PostalCode,State,Website\r\n1,,Apple,US,\"Apple Campus, 1 Infinite Loop\",Cupertino,95014,California,\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--");
req.end();0
Answers
-
According to chapter 2.3 of PermID API User Guide, if you want to pass access token as a parameter in the URL rather than as an HTTP header, the parameter name is "access-token" and not "x-ag-access-token".
0 -
After updating my node code i get the following back in terminal after trying to run node.
$ node index.js
<!DOCTYPE html>
<html>
<head>
<title>Error</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>An error occurred.</h1>
<p>Sorry, the page you are looking for is currently unavailable.<br/>
Please try again later.</p>
</body>
</html>
Below is the code in index.jsconst express = require('express')
const app = express()
const request = require('request');
const cors = require('cors');
// const http = require('http');
// const https = require('https');
const util = require('util')
// Sets an initial port. We"ll use this later in our listener
const PORT = process.env.PORT || 8080;
app.use(cors());
var corsOptions = {
origin: '*',
optionsSuccessStatus: 200
};
// Service end-point (search)
// app.get('/upload', function (req, res) {
// var options = {
// method: 'GET',
// url: 'https://api.thomsonreuters.com/permid/match/file?Content-Type=multipart/form-data',
// headers: {
// 'cache-control': 'no-cache',
// 'x-openmatch-dataType': 'Organization',
// 'x-openmatch-numberOfMatchesPerRecord': '1',
// 'x-ag-access-token': '96CT8NAgnieeuiYA2YPeNMnbPMfHu4W8'
// },
// formData: {
// file: undefined
// }
// };
// request(options, function (error, response, body) {
// if (error) throw new Error(error);
// console.log(response)
// console.log(body);
// });
// });
// function dataReturned(e) {
// console.log("Success!");
// finalRes.end(e);
// }
// const server = http.createServer(app)
// server.listen(PORT, () => {
// console.log(`app started! at port ${PORT}`);
// });
var http = require("https");
var options = {
"method": "POST",
"hostname": "api.thomsonreuters.com",
"path": "permid/match/file",
"headers": {
"content-type": "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
"x-openmatch-numberOfMatchesPerRecord": "1",
"x-openmatch-dataType": "Organization",
"cache-control": "no-cache",
"Postman-Token": "101e3dbe-96bf-4b1c-9fce-8dad5f4ff975"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write("------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--");
req.end();0 -
To troubleshoot this I suggest you capture the HTTP request and response going on the wire. Use an HTTP analyzer or a network sniffer.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 688 Datastream
- 1.4K DSS
- 620 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 254 ETA
- 557 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 276 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 663 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 229 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛