Question

Unable to get next pages from API

  • 16 June 2023
  • 9 replies
  • 102 views

Hey there Copper,

For some reason, I cannot get more than 1 page from the API. Can someone help me?


9 replies

Hi @Skyline Nate 


You need to use the "page_size" parameter to specify the number of results you are wanting per page.


If the response returned by Copper is having records equal to your "page_size", you would need to fire out another request to Copper by passing an additional parameter called "page_number”

 

eg

First request parameters

“page_size": 200
"page_number": 1

 

Second request parameters

“page_size": 200
"page_number": 2

 

 

Third request parameters

"page_size": 200
"page_number": 3

 

And so on, till Copper returns a response with no records.

 

All I’m sending is page number because I don’t need more than the defaults. Would that cause problems?

Also in my Postman I’m sending “page_size”, “page_number”, and “sort_by” and still getting page 1 results for an explicitly given page 2, 3, 4, etc.

It should be fine then, as the default for the page_size parameter is 20

 

Did you check in Copper to see whether the data matching your search criteria actually exists?

 

Also in the response returned by Copper are you receiving a 200 response code or are you receiving some error?

Here I have two different programs showing the same problem. I am getting 200 error responses. I think it’s something wrong with Copper internally.

And I know there are more records than the 20~25 I call for every time because of the x-pw-total header 

 

 

Hi @Skyline Nate ,

 

Very strange.

You seem to be doing everything correctly.

 

Is the X-PW-TOTAL always constant i.e 18565 or is it changing everytime you run a new query?

 

FYI a response code of 200 by Copper means that everything is working fine from Copper’s end.

The x-pw-total is constant. Truth be told, we have moved away from Copper and keep it as an archive of past information. We’re looking to extract that past information out of Copper and as per their documentation, if you’re climbing through pages you can use this mathematical formula to figure the total pages to go through

total_pages = ceiling(x-pw-total / page_size)

Where we want the rounded up (ceiling) of whatever (x-pw-total / page_size) is.

In my examples provided, I should have 743 (from 742.6) pages to climb through to get all of my opportunity record pages (25 page size).

But I’m also trying to get Activity records too which has a total page count of 41,739 (834,776 records) (20 page size)

The program I wrote can get through all of those pages just fine, however Copper has only ever given me page 1 of each search endpoint every single time, regardless of any parameters that I put into the system.

Not sure, but there might be something setup wrong with your Copper account which is why you are having this problem.

 

Someone from the Copper team who has access to your account would probably be able to sort it out for you.

 

@Michelle from Copper any idea as to what might be going wrong here?

Userlevel 7
Badge +7

@Skyline Nate @Harsh hm, I’ll have to get one of our technical folks to take a closer look. I’ll have them review this thread and also the videos. @Skyline Nate you’ll get an email from our system, followed by a response from one of my colleagues. @Harsh thanks for your help here! 🙂

 

Edit: looks like you’re already talking to RJ on our technical team. I’ll add this thread to the existing ticket. Thanks Nate!

Reply