Skip to main content
Participant
June 27, 2021
Question

Postman Approach Working with PDF Extract API, Having Trouble With R approach

  • June 27, 2021
  • 1 reply
  • 1547 views

I am getting 403 errors when I attempt to access the PDF Extract API using R (specifically the httr package).

 

The API works fine in Postman, and I have successfully used the following R code to generate a "Bearer" token:

 

r = POST(
  url = "https://ims-na1.adobelogin.com/ims/exchange/jwt/",
  body = list(
    client_id = {{Placeholder for client_id}},
    client_secret = {{Placeholder for client_secret}},
    jwt_token = {{Placeholder for jwt_token}}
  ),
  encode = "form"
)

access_token = content(r)$access_token
Authorization = paste("Bearer", access_token)

 

The "Bearer" token that I have generated using R works fine when I copy and paste it into Postman for posting a PDF file and getting the extracted JSON data. So far, so good.

 

But I get a 403 error if I try to use the same "Bearer" token (and my client_id) to get the same extracted JSON data into R using the following R code:

httr::GET(
  url = "https://cpf-ue1.adobe.io/ops/id/{{Placeholder for x-request-id}}",
  config = list(
    add_headers(
      Authorization = {{Placeholder for Bearer token}},
      "x-api-key" = {{Placeholder for client_id}}
    )
  ),
  verbose()
)

 

Has anyone else solved this problem, or is there any documentation for R users I may have missed? Thanks!

This topic has been closed for replies.

1 reply

Participant
October 28, 2021

Have you managed to solve this? Have the exact same issue

Participant
October 28, 2021

I'm afraid I'm still stuck at this point. I fell back to using one of the R packages to extract text from a large corpus of PDF files stored locally. The R package did a reasonably good job at this task, but I imagine the PDF extract API would have performed significantly better with the heavily formatted PDFs.

Participant
October 28, 2021

I figured it out. In Postman go to headers of your POST call response and there is your parameter there.