Skip to main content
Solved

API call to external resource works in POSTMAN but doesn't work in httpcaller

  • December 13, 2018
  • 4 replies
  • 266 views

Forum|alt.badge.img

Hello:

I have an external resource that has an API that utilizes basic authentication using a token.

When I run the api call using postman or other REST API testing software, I get an OK response.

When I try running it using the httpcaller, I get a:

HTTPCaller(HTTPFactory): Received HTTP response header: 'HTTP/1.1 403 Forbidden' message.

Inspecting the response body gives:

{"code":"rest_forbidden_context","message":"Sorry, you are not allowed to view entries","data":{"status":403}}

 

I know that the api is working because it works in POSTMAN and other REST API testing software. What am I missing to get http caller to work?

I'm new to APIs and to FME. I'll be happy to provide any info needed.

Thanks!

 

Herbert Cruz

 

Here's the input on FME.

 

And here's the RESTLET testing input

 

 

 

Thanks everyone!

Best answer by yong_sa

I figured it out. Instead of putting the API token into the authorization header, I had to put in a username and password combination encoded in base 64 to successfully get information from the API.

 

Thanks!

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

Forum|alt.badge.img

Hi @yong_sa, can you share the details of the request that is working in POSTMAN?

 

- URL

- Headers

- HTTP Method (GET,POST, etc. )

- Body (if applicable)

Thanks


Forum|alt.badge.img
  • Author
  • December 13, 2018

URL: https://pocoworks.portcoquitlam.ca/wp-json/frm/v2/entries

HTTP Method: GET

Headers:

Authorization : "API TOKEN FROM RESOURCE"

Body: None


Forum|alt.badge.img
  • Author
  • Best Answer
  • December 14, 2018

I figured it out. Instead of putting the API token into the authorization header, I had to put in a username and password combination encoded in base 64 to successfully get information from the API.

 

Thanks!


Forum|alt.badge.img

I figured it out. Instead of putting the API token into the authorization header, I had to put in a username and password combination encoded in base 64 to successfully get information from the API.

 

Thanks!

Great! You could also use the Authentication option in the HTTPCaller and just enter the username and password. This will generate the header with the base 64 encoded string for you.