Exporting with REST API and Python requests

Hello,
I am trying to make a custom csv export using python and REST API to limit how many of the properties get exported (ie not ALL from the export module). For example i would like to get a list of all items in an item set but WITHOUT the extracted text property?
Is there a way to limit what gets returned in a JSON file request, or can that only happen later through JSON file modification or from selecting which JSON properties to turn to make the CSV?

I have tried running

r = requests.get('https://ibali.uct.ac.za/api/items/?item_set_id=7051', params=params)

but first of all I am not getting all the items in the item set I think, and second I am not sure if I can adjust the query to exclude the data in extracted text field?

Many thanks,
Sanjin

The way to go here would probably just be to toss properties you don’t want after reading the JSON response but before processing them further,

As for getting all the results, API responses are paginated so if you have many resources you’ll probably need to make several requests to get all the pages.

1 Like