Greetings everyone.
I’ve just started building a quite simple application in which I created a table with some fields as “Name”, “Last Name”, among others.
When I try to use the API to get a table’s rows, I get the following error independently of using Bash, Python or JS:
{'message': 'API key cannot query tables'}
I’m using the following python script:
# Get rows requires Business plan or above
import requests
r = requests.post(
"https://api.glideapp.io/api/function/queryTables",
headers={"Authorization": "Bearer xxxxxxxxxx"},
json={
"appID": "xxxxxxxx",
"queries": [
{
"tableName": "native-table-xxxxxx"
}
]
}
)
result = r.json()
print(result)
Also, I’m using the following Bash script:
Get rows requires Business plan or above
curl --request POST 'https://api.glideapp.io/api/function/queryTables' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer xxxx-xxxx-xxxx-xxx-xxxx' \
--data-raw '{
"appID": "xxxxxx",
"queries": [
{
"tableName": "native-table-xxxxxx"
}
]
}'
Both approaches return exactly the same error as mentioned above.
I’ve tried using another one of the API endpoint, specifically the Add Rows. By using the following python script, I’m successfully able to add rows to my table:
import requests
r = requests.post(
"https://api.glideapp.io/api/function/mutateTables",
headers={"Authorization": "Bearer xxxx-xxxx-xxxx-xxxx-xxxx"},
json={
"appID": "xxxxx",
"mutations": [
{
"kind": "add-row-to-table",
"tableName": "native-table-xxxxxx",
"columnValues": {
"Name": "new name by api call",
"AGK0b": "new lst name",
"Email": "aaa@ubidots.com",
"m8C8b": "1993",
"Photo": "Photo"
}
}
]
}
)
result = r.json()
print(result)
This is the result ( I executed the script twice)
Given the fact that I can add rows to this table, leads me to think that there is nothing wrong with my API key permissions to edit said table. With that in mind, I really can’t tell what am I missing over here regarding this subject. Help is greatly appreciated.
Best regards