Watermark Detection

Durch | Aktualisiert 13 дней назад | Visual Recognition

9.7 / 10



Service Level


Health Check


Zurück zu allen Diskussionen

Forbidden 403 error when making POST calls from R

Rapid account: Anthonypileggi
4 года назад

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!

Rapid account: Anthonypileggi
anthonypileggi Commented 4 года назад

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

Rapid account: Restb
restb Commented 4 года назад

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.

Nehmen Sie an der Diskussion teil - fügen Sie unten einen Kommentar hinzu:

Anmelden / Registrieren, um neue Kommentare zu veröffentlichen