How can I download the complete list of Observation Fields?

I want analyze all the existing Observation Fields. There are currently thousands of them, so manually scraping the nearly 500 pages of search results is not feasible.

I’ve searched the forum topics for a half-hour and have not been able to find an answer to this question anywhere. I thought it should be something available through the API. If it is, it’s not documented. returns a page titled “Error” that only says “Cannot GET observation_fields”.

1 Like

You can use the older API, documentation here:

For example, gets the first page of observation fields.

Here’s a python script that will output a csv of all observation fields (takes about 10 mins to run):

import requests
import json
import csv
import time

apiurl = ''

fileout = open('obsfields.csv', encoding='utf-8', mode='w+', newline='')
csvwriter = csv.writer(fileout, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)

for page in range(1,485):
        r = requests.get(apiurl + str(page))
        for field in r.json():
            csvwriter.writerow([field.get('id',''), field.get('name',''), field.get('datatype',''), field.get('user_id',''), field.get('description',''), field.get('created_at',''), field.get('updated_at',''), field.get('aallowed_values',''), field.get('values_count',''), field.get('users_count',''), field.get('uuid','')])

        print("error on page " + str(page))
1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.