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.
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"))
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?
Join in the discussion - add comment below:
The code snippet is generated by RapidAPI and does have errors. Try using this instead: