Mashvisor

FREEMIUM
By Mashvisor | Updated 15일 전 | Data
Popularity

9.2 / 10

Latency

3,548ms

Service Level

93%

Health Check

N/A

Back to All Discussions

A few comments on the R httr code | x_rapidapi and an issue with parentheses

Issue One: Parentheses

On every R code snippet provided by this RapidAPI page there is a misplaced parentheses. This is the code:

response <- VERB("GET", url, add_headers(x_rapidapi-key = 'RapidAPI Key REMOVED', x_rapidapi-host = 'mashvisor-api.p.rapidapi.com', '), query = queryString, content_type("application/octet-stream"))

The final parentheses before the closing bracket of function add_header() fucks up the code.

Issue 2: = signs

In the code theres a few occasions where one = is used when in R syntax it should be ==.

response <- VERB("GET", url, add_headers(x_rapidapi-key = 'RapidAPI Key REMOVED', x_rapidapi-host = 'mashvisor-api.p.rapidapi.com', ), query = queryString, content_type("application/octet-stream"))

should become

response <- VERB("GET", url, add_headers(x_rapidapi-key == 'RapidAPI Key REMOVED', x_rapidapi-host == 'mashvisor-api.p.rapidapi.com', ), query == queryString, content_type("application/octet-stream"))

Issue 3: x_rapidapi not recognized.

Whenever I run the code with the parentheses and == corrections, I get a return result that reads: Error in named(list(...)) : object 'x_rapidapi' not found

I’ve tried looking through httr documentation and I can’t figure out an answer. It seems that this might be a Rapid API issue and not an httr issue. Any thoughts on how I can get this code to run?

Rapid account: Rapidtom
rapidtom Commented 3년 전

The code snippet is generated by RapidAPI and does have errors. Try using this instead:

response <- VERB("GET", url, add_headers('x-rapidapi-key' = 'API KEY GOES HERE', 'x-rapidapi-host' = 'mashvisor-api.p.rapidapi.com'), query = queryString, content_type("application/octet-stream"))

Join in the discussion - add comment below:

Login / Signup to post new comments