API response is taking 10 to 15 minutes

We are using api v2. Our issue is that when we try to get 100 or more records from the customer BO it is taking 10 to 15 minutes before it comes back. Is there anything that we can do to speed up this process? Can we use LIKE in the files to make it faster?

4 Likes

Which information do you need from the customer? Which endpoint on CustomerSvc are you using?

2 Likes

We want to filter the list based on Name, CustId or CustNum, We want all matched records if the users enters a keyword.

2 Likes

Do you need the entire record? or only parts of it? The less information you ask for, the faster it will be.

4 Likes

Which is why I (annoyingly) encourage people to use Functions or the BAQSvc. Not only are you reducing the payload, they tend to run quicker than GetRows or GetList.

11 Likes

Or v1 OData with $select parameter.

1 Like

Many different ways to get it done, that’s why it’s good to know what you are looking to achieve.

One thing to keep in mind is that the api help swagger page will not perform very well with large responses, so you may be seeing a bit of a delay there.

5 Likes

The developer working on this said they only want Name, CustID, CustNum and address.

2 Likes

I’ve asked the developer to create an account so he can respond on here without me being the middleman.

5 Likes

IF you need extra data not included in the business object is when a BAQ shines. If everything is included, then OData works.

6 Likes

From what I understand this is for the integration with CPQ. The devs are using api calls to pull back customer data. They just need to display four or five fields.

1 Like

I would use OData in this case

/api/v2/odata/<yourcompany>/Erp.BO.CustomerSvc/Customers?$select=Name,CustID,CustNum,Address1,Address2,Address3,City,State,Zip,Country&$filter=contains(Name, 'Test')

5 Likes

Have you tried this in Postman? The rest help / swagger sometimes misbehaves.

5 Likes

You can call a BAQ with API calls and use @Mark_Wonsil suggestion of a BAQ. We do this for our ecom site and it really helps. Also @mbayley’s suggestion of setting the fields you want returned in the OData call would work.

4 Likes

I’ll mention that I very rarely use OData because there is usually some other related field I need. A BAQ would offer future flexibility if suddenly they need the Terms (Description not Code)

9 Likes

That’s why we went with a BAQ as well. Much easier to modify later if needed.

2 Likes

One thing I like about odata is it lives with my source code calling it. But I still don’t use it much for the same reason you mention.

4 Likes

So how do I expose the BAQ to API? Will it automatically show up here in swagger?

2 Likes

If it is shared I think.

4 Likes

Running a BAQ from REST follows all the same rules that running it in the browser client. It respects the Share status as well as the Security ID protections. If that user can run it in a browser then they can run it from REST.

4 Likes