cancel
Showing results for 
Search instead for 
Did you mean: 

PSB Rest API Question

Aspirant

PSB Rest API Question

Greetings guys!

 

I'm currently working on a service that checks our customers overall status on F-secure and checks if they need attention. 

Service gets all our customers computers from psb api and parses them through checking various properties under different categories.

 

The problem im facing that it takes increeeeeeedibly long to fetch those 4500-5000 computers from your API before I can start the parsing.

 

Is it normal that the API handles 23-25 requests in 260-300seconds? I feel like thats absurd.

And this is just for one category of computers.

Then I would need to make same 23-25 request for every category I need to check.

 

I could maybe make that faster with some parallel/async work making those requests in batches, but your API doesnt give the maximum amount of pages some endpoint has.

 

For example, would be nice if the pagination element would have property "lastPage: 25"

 

With that I could create batches for example 5 requests simultaneously to the API and wouldn't have to wait for the previous request to return to get the "hasMoreElements" property.

 

Sincerely,

Olli Elolähde

Receptum Oy

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
F-Secure

Re: PSB Rest API Question

So far we've never had the need to introduce the lastPage parameter of anything of the kind as the API is designed having mostly our UI in mind and our UI uses the infinite scroll mechanism.
Judging from the numbers you're providing I'm guessing that you have already tried setting 'perPage' to 200?

I totally agree with you. That sounds like a really long response time and I will create a ticket for our development team so that this gets fixed.

For now I can tell you however that it's highly unlikely we will implement the "lastPage" idea. We would have to update all listing endpoints in order to stay consistent.

What you could do is first call the /mp/v1/partners/<accountId>/statistics endpoint that will return the number of all computers which you can use to calculate the number of pages.
Alternatively you can call the /mp/v1/partners/<accountId>/reports/computers endpoint to get a CSV of all computers. As far as I understand there are currently plans of extending that endpoint, so that it can also return JSON based on the provided HTTP headers
2 REPLIES
F-Secure

Re: PSB Rest API Question

So far we've never had the need to introduce the lastPage parameter of anything of the kind as the API is designed having mostly our UI in mind and our UI uses the infinite scroll mechanism.
Judging from the numbers you're providing I'm guessing that you have already tried setting 'perPage' to 200?

I totally agree with you. That sounds like a really long response time and I will create a ticket for our development team so that this gets fixed.

For now I can tell you however that it's highly unlikely we will implement the "lastPage" idea. We would have to update all listing endpoints in order to stay consistent.

What you could do is first call the /mp/v1/partners/<accountId>/statistics endpoint that will return the number of all computers which you can use to calculate the number of pages.
Alternatively you can call the /mp/v1/partners/<accountId>/reports/computers endpoint to get a CSV of all computers. As far as I understand there are currently plans of extending that endpoint, so that it can also return JSON based on the provided HTTP headers
Aspirant

Re: PSB Rest API Question

Thanks Milka for the response!

 

Thanks for creating a ticket for the long response times.

Yeah, I've set the perPage to "max" which should be 200 if the manuals are correct :)

 

That statistics page sounds like an awesome plan, I'll try to look into that and create some async batch action to get this going faster!

 

Cheers again Milka and I'm looking forward to that report which would then list all the computers to a JSON!

 

Have a nice rest of the week!