Ask your pdf in R

Hi R users,
Does anyone have tried to use Askyourpdf in R ?
My colleague accesses the API service through python thus I was wondering whether it would be possible to do something similar in R

Thank you for your help !! :smiley:

Yes, but it'll take some work.

You need to look at the API documentation: AskYourPDF API Documentation - AskYourPDF Docs

As you can see, most of it is just sending http requests. In R, there are several packages to send such requests, the easiest one to get started right now is probably {httr2}.

So, some untested code that may work:

req <- request("") |>
  req_headers("x-api-key" = "YOUR_API_KEY") |>
  req_url_query("url" = "")

See also this blog post for more examples, including how to treat the response.