Hello everyone,
i have a tool in Python for automatically, periodically grabbing People from Copper.
This tool worked for years, but all of a suddon one of the pages has 199 items instead of 200. (was the first, now seems to be the second?)
Note the total number of People in Copper is around 21k so i use to have many pages.
CONTATTI_PER_PAG=200
contaPagg = 0
contatti = {}
nrProgressivoContattiLetti = 0
TOKEN_OWNER_EMAIL = 'sales@extravega.com'
while contaPagg < NR_MAX_PAGG or NR_MAX_PAGG == 0:
contaPagg += 1
url = 'https://api.copper.com/developer_api/v1/people/search'
body = {
"page_size": CONTATTI_PER_PAG,
"sort_by": "date_modified",
"sort_direction": "desc",
"page_number": contaPagg
}
headers = {'X-PW-AccessToken': API_KEY_TOKEN,
'X-PW-Application': 'developer_api',
'X-PW-UserEmail': TOKEN_OWNER_EMAIL,
'Content-Type': 'application/json'}
r = requests.post(url, headers=headers, params=body)
contacts = r.json()
nrContattiLettiPerPag = len(contacts)
nrProgressivoContattiLetti += nrContattiLettiPerPag
My question is then: why the API started to deliver 199 items?
Thanks
Best answer by Michelle from Copper
View original