A beginner's question: My First API Access

Dear colleagues from Coda,

Just started to explore the CODA environment today and I created a short Python script to run a lookup at my CODA document directory. I was able to create an API key at my account stetting page and also to place the basic Python “requests” lookup (get), as shown in the API instructions at the first sample. I also created a document using a basic “To Do” template and updated some entries.

The API lookup gives me the following answer: No error, no data, see the log below from the response text section:

200
{“items”:,“href”:“https://coda.io/apis/v1beta1/docs?isOwner=true&query=New&limit=100”}
utf-8

Any idea how to fix it. Is any further permission required to do programmatic lookups?

Thanks in advance for your support.
Regards, Claude

Example code:

simple REST AOI

import requests
headers = {‘Authorization’: ‘Bearer x–hidden–x’}
uri = ‘https://coda.io/apis/v1beta1/docs
params = {
‘isOwner’: True,
‘query’: ‘New’,
}

res = requests.get(uri, headers=headers, params=params).json()

r = requests.get(uri, headers=headers, params=params)
print(r.status_code)
print(r.text)
print(r.encoding)

Where are you hosting your python script?

Hello Johg, its hosted locally under my Anaconda Jupyter platform (Python 3.7).
Just tested a qualified API access using the document id and this second attempt worked OK, returning data.

uri = ‘https://coda.io/apis/v1beta1/docs’ + ‘/’ + mydocid

The issue reported refers to the directory list (sample1).

My guess is you don’t have any docs with New in their names… You probably don’t need that parameter.

Good catch, thanks for support. By removing the argument query, I got the document references in the reply, which seems to be correct.