I am having issues using RapidApi within NetSuite. Has anyone done this before?
headersObj = [
{
name:"x-rapidapi-host",
value:"hostishere"
},
{
name:"x-rapidapi-key",
value:"keyishere"
}
];
response = https.request({
method: https.Method.GET,
url: "MyURLishere",
headers: headersObj
});
I get the following return:
error 400 message: Invalid API key. Go to https:docs.rapidapi.com/docs/keys for more info.
The API key is correct having tested through postman.
The header was missing "Accept":"application/json".
headersObj = {
"Content-Type": "application/json",
"Accept":"application/json",
"x-rapidapi-host": "Myhost",
"x-rapidapi-key": "Mykey",
"Host": "host"
};
If you are making the call from within Netsuite you'd need to use their https library:
define(["N/https"], function(http){
headersObj = [{ name:"x-rapidapi-host", value:"hostishere" }, { name:"x-rapidapi-key", value:"keyishere" }];
var resp = http.get({url:'your url', headers:headersObj});
// do something
});