REST API run time

harshi_ramesh
Tera Expert

Hi All

 

I had a query regarding REST API run time. I have an API which is been called using Scheduled Job, but it is taking time.

Does the time an API takes to complete depend on the payload it is pulling from the respective server?

 

Please help me with a solution on the same.

Thanks & Regards,

HR

 

#RESTAPI #API #integration

4 REPLIES 4

Kieran Anson
Kilo Patron

Hi,

If your scheduled job is setup to call an API and doesn't use pagination, you will see long run times of your scheduled job and to the API service. OOB 5MB payload is the largest, but the API service you're calling could be constructing much larger payloads.

 

To help further, we'd  need to see the the script of your scheduled job to help optimise it

Hi @Kieran Anson 

 

Sorry for replying late. Here is the script attached. 

So you suggest to breakdown the record pull to smaller chunks. We are trying to pull around 5k records, let me know if breaking down is required for this much amount of data.

If so please help me on the same.

 

Thanks & Regards,

HR

Thanks for attaching the script, some pointers of possible improvement

  1. See if there is an API endpoint that allows you to return a nested payload rather than the current 2-part API call you're doing. 
  2. See if there is an API endpoint where you can pass in multiple computer IDs rather than 1 computer ID per call
  3. How long is this script running? If it's running for several minutes you could benefit from breaking up the scheduled job into smaller ones. An example being chunking up the ID's into say groups of 20, and then firing an event with those 20 for a script action to pickup later on...that would free up instance resources and allow for a more async processing style.

Thanks @Kieran Anson for the response and suggestions.

1. I don't have an API to return nested payload. The API is been divided to two, one to store the total ID's and the second API to call each ID.

2. Not provided or not available.

3. Have added pagination setRateLimit() and checking the duration.

 

Thanks & Regards,

HR