Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Aug 23, 2023 02:02 AM - edited Aug 23, 2023 02:11 AM
Invoke-WebRequest -Uri "https://api.airtable.com/v0/{baseId}/{tableIdOrName}?maxRecords=3&view=Grid%20view" -Headers @{"Authorization"="Bearer YOUR_SECRET_API_TOKEN"}
Error Message in Windows Power Shell
Invoke-WebRequest : {"error":{"type":"INVALID_PERMISSIONS_OR_MODEL_NOT_FOUND","message":"Invalid permissions, or the
requested model was not found. Check that both your user and your token have the required permissions, and that the
model names and/or ids are correct."}}
At line:1 char:1
+ Invoke-WebRequest -Uri "https://api.airtable.com/v0/{baseId} ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
I tried using curl command also,
curl "https://api.airtable.com/v0/{baseId}/{tableIdOrName}?maxRecords=3&view=Grid%20view" -H "Authorization: Bearer YOUR_SECRET_API_TOKEN"
Error Message in Windows Power Shell
Invoke-WebRequest : Cannot bind parameter 'Headers'. Cannot convert the "Authorization: Bearer
YOUR_SECRET_API_TOKEN" value of type "System.String" to
type "System.Collections.IDictionary".
At line:1 char:96
+ ... %20view" -H "Authorization: Bearer YOUR_SECRET_API_TOKEN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Solved! Go to Solution.
Aug 24, 2023 02:59 AM
Can you try the example curl request that you will find here:
https://airtable.com/{YOUR_BASE_ID}/api/docs#curl/table:table%201:retrieve
Just add your access token in the reqest. If you not receiving the correct response, check the permission for your access token.
Aug 24, 2023 02:17 AM
I had the same issue. Visit this page there you will find the example request that worked for me:
https://airtable.com/{YOUR_BASE_ID}/api/docs#curl/table:table%201:retrieve
Make sure to replace {YOUR_BASE_ID} with your id "app...."
Aug 24, 2023 02:39 AM
Thanks @philm for the reply. Have already tried this but still not working. Tried in postman.
1) https://localhost:5001/api/airtable/read/{recordId}
2) https://api.airtable.com/v0/{_baseId}/{_tableName}/{recordId}
Added Authorization as Headers 'Key' and "Bearer YOUR_APP_KEY_OR_ACCESS_TOKEN" as 'Value' for both 1) and 2)
Aug 24, 2023 02:59 AM
Can you try the example curl request that you will find here:
https://airtable.com/{YOUR_BASE_ID}/api/docs#curl/table:table%201:retrieve
Just add your access token in the reqest. If you not receiving the correct response, check the permission for your access token.
Aug 24, 2023 03:31 AM
Thanks @philm . The issue was I hadn't granted read permission to my personal access token. Please see attached image as reference.