Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Issues with rapid api

Blewis21
7 - Meteor

Hello, 

 

I'm having trouble setting up my API via RapidAPI... I've followed the instructions here

https://community.alteryx.com/t5/Engine-Works-Blog/REST-API-In-5-Minutes-No-Coding/ba-p/8137

 

and had no problem setting up that API; however, I'm clearly doing something wrong with Rapid API as I keep getting 'invalid API Key'. Yes, the key is correct as I can run it through Rapid API's website. 

 

What am I doing wrong?

 
 

 

var unirest = require("unirest");

var req = unirest("GET", "https://hotels4.p.rapidapi.com/properties/list");

req.query({
	"destinationId": "1506246",
	"pageNumber": "1",
	"checkIn": "2020-01-08",
	"checkOut": "2020-01-15",
	"pageSize": "25",
	"adults1": "1",
	"currency": "USD",
	"locale": "en_US",
	"sortOrder": "PRICE"
});

req.headers({
	"x-rapidapi-key": "abc123",
	"x-rapidapi-host": "hotels4.p.rapidapi.com",
	"useQueryString": true
});


req.end(function (res) {
	if (res.error) throw new Error(res.error);

	console.log(res.body);
}); 

 

2 REPLIES 2
KaneG
Alteryx Alumni (Retired)

I can't test this, but the first thing I noticed was the API Key is selected in the Payload, when I believe it should be a header, The query strings should be in the payload.

Blewis21
7 - Meteor

Thank you! That was it. 

 

I'm adding screenshots just in case anyone else has issues like I did.

Labels