Solved

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

  • 14 December 2018
  • 4 replies
  • 36 views

Badge

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!

icon

Best answer by yong_sa 14 December 2018, 01:06

View original

4 replies

Badge

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

Badge

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

HTTP Method: GET

Headers:

Authorization : "API TOKEN FROM RESOURCE"

Body: None

Badge

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!

Badge

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.

Reply