Solved

Making a GET request to a 3rd party API

  • 24 November 2022
  • 3 replies
  • 99 views

Badge +1

So, Currently i`m using a 3rd party api. This one is currently divided by 2 parts. 1 where we call an api endpoint to retrieve a list of objects. From there we scrape them one by one and push them to our database.

Part 2 is where we select every row where a certain status = 0. Now here comes the weird part. Due that the api endpoint has a need for a certain id. So the most smartest decision would be : 

 

SET @url = CONCAT('<secret_api_endpoint>/', @documentId)

Sadly enough the last part where we insert the information to the database hasnt even reached. So something went wrong when calling for the api endpoint

icon

Best answer by Anthony 25 November 2022, 11:25

View original

This topic has been closed for comments

3 replies

Userlevel 6
Badge +4

Hello Anthony,

It appears that either your first API request (to retrieve the list of objects) or the subsequent parsing of that list of objects has gone wrong. I would start by checking if the API request is being performed successfuly and if you are indeed getting the list of objects as a response.

Some things you can do:

  • I assume that you're using an HTTP connector to perform your API request. Check Indicium's error log for any errors related to this process action or the process procedure that follows it.
  • You can map both the Status code and the HTTP status code output parameters to a process variable and inspect their value. These status codes will provide a lot of information about the success or failure of the HTTP connector.

An easy way to inspect to process variables is by starting the process flow in a Windows GUI which is running in development mode and then using the Process Flow Monitor:

I hope this helps.

Badge +1

Hey Vincent,

 

I heavily doubt that parsing the list of objects went wrong. Because this is the only part that was succesful.

Let me give you a more insight about the problem that i`m dealing right now. We currently have 2 systems flows : 

 

  1. System flow that retrieves a list and gets parsed. This part is succesful. All the necesary data has been saved
  2. System flow that gets a detailed information of the id that has been saved in the database. This part is where we are struggling right now. Because if we are trying to catch any http_code that isnt 200 we are trying to log the error as well in our log table but sadly no success. 
Badge +1

Never mind. I found the solution. Looking in our Indicium error log i found out that the call we were making had a 404 with a HTML response instead of JSON (Tested this using postman). This caused the system flow to entirely stop. Weird because in our next part we actually had an if condition where : 

 

IF @http_code <> 200
'Do something that catches the error'

It didnt even process this part. weirdly enough. And i dont know how that comes. But i managed to fix the problem.