Watermark Detection

द्वारा | अपडेट किया गया एक वर्ष पहले | Visual Recognition

9.2 / 10



सेवा का स्तर


सभी चर्चाओं पर वापस जाएं

Forbidden 403 error when making POST calls from R

2 वर्ष पहले

I’m trying to make API calls using the httr package in R, but it keeps returning a 403 error. Is there something obviously wrong with my API call?

R code I am using:

  url = "",
  config = httr::add_headers(
    `X-RapidAPI-Host` = "",
    `X-RapidAPI-Key` = Sys.getenv("RAPIDAPI_KEY"),
    `Content-Type` = "application/x-www-form-urlencoded"
  #query = list("rapidapi-key" = Sys.getenv("RAPIDAPI_KEY")),
  body = list(image_url = "")
  #encode = "form"

And the 403 response I keep getting:

Response [{my_api_key}&]
  Date: 2020-06-25 21:28
  Status: 403
  Content-Type: text/html; charset=utf-8
  Size: 136 B
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">

Any help would be appreciated, I have 50k images I want to run this on ASAP. Thanks!

anthonypileggi commented 2 वर्ष पहले

Awesome, this works perfectly! Thank you very much for the quick response!!

restb commented 2 वर्ष पहले

Hey Anthony,

Looking at your R code it looks like you are sending request headers (rapidapi-key) and body (image_url) as query parameters making not possible for RapidAPI to authenticate your request.

Also, it looks like the URL that you are using is not the correct one. You should use

Taking a look at the getting started website from httr this, or something close to this, should work:

  url = "",
    X-RapidAPI-Host = "",
    X-RapidAPI-Key = Sys.getenv("RAPIDAPI_KEY"),
    Content-Type = "application/x-www-form-urlencoded"
  body = list(image_url = ""),
  encode = "form"

I hope this would help with your integration.

चर्चा में शामिल हों - नीचे टिप्पणी जोड़ें:

नई टिप्पणियाँ पोस्ट करने के लिए लॉग इन / साइनअप करें
रेटिंग: 5 - वोट: 1