Troubleshooting of Airtable API: Difference between revisions
Jump to navigation
Jump to search
| (8 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
Troubleshooting of Airtable API | Troubleshooting of Airtable API | ||
{ | == How to fix API cache == | ||
Problems: [https://community.airtable.com/t5/development-apis/api-get-call-not-retrieving-updated-table-field-data/td-p/69002 API GET call not retrieving updated table field da... - Airtable Community] | |||
Solution: Example PHP code<ref>[https://stackoverflow.com/questions/15493769/is-there-a-way-to-tell-curl-to-not-use-cache php - Is there a way to tell curl to not use cache - Stack Overflow]</ref> | |||
<pre> | |||
$ch = curl_init(); | |||
curl_setopt($ch, CURLOPT_URL, "API_URL_HERE"); | |||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |||
$headers = [ | |||
'Pragma: no-cache', | |||
'Cache-Control: no-cache' | |||
]; | |||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); | |||
$response = curl_exec($ch); | |||
if(curl_errno($ch)) { | |||
echo 'Error:' . curl_error($ch); | |||
} | |||
curl_close ($ch); | |||
echo $response; | |||
</pre> | |||
== How to fix INVALID_PERMISSIONS_OR_MODEL_NOT_FOUND == | == How to fix INVALID_PERMISSIONS_OR_MODEL_NOT_FOUND == | ||
| Line 100: | Line 124: | ||
# Verify that the specified field name ("XXX" in this case) exists in the table. | # Verify that the specified field name ("XXX" in this case) exists in the table. | ||
# If it doesn't, ensure you're using the correct field name in your query or action. | # If it doesn't, ensure you're using the correct field name in your query or action. | ||
== How to fix NOT_FOUND or INVALID_PERMISSIONS_OR_MODEL_NOT_FOUND == | |||
Error message: | |||
<pre> | |||
( | |||
[error] => NOT_FOUND | |||
) | |||
</pre> | |||
or | |||
<pre> | |||
{ | |||
"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." | |||
} | |||
} | |||
</pre> | |||
Solution: Check the URL of API | |||
== Further reading == | == Further reading == | ||
* [https://airtable.com/developers/web/api/introduction Introduction - Airtable Web API] | |||
* [https://support.airtable.com/docs/airtable-api-common-troubleshooting Airtable API Common Troubleshooting | Airtable Support] | * [https://support.airtable.com/docs/airtable-api-common-troubleshooting Airtable API Common Troubleshooting | Airtable Support] | ||
* [https://support.airtable.com/docs/field-type-overview Field Type overview | Airtable Support] | |||
* [https://community.airtable.com/t5/development-apis/bd-p/development Development & APIs | Airtable Community] | |||
* Publish Blog version: [https://errerrors.blogspot.com/2023/09/troubleshooting-of-airtable-api-errors.html 解決 Airtable API 常見問題] | |||
== References == | == References == | ||
Latest revision as of 17:55, 23 September 2023
Troubleshooting of Airtable API
How to fix API cache[edit]
Problems: API GET call not retrieving updated table field da... - Airtable Community
Solution: Example PHP code[1]
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "API_URL_HERE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$headers = [
'Pragma: no-cache',
'Cache-Control: no-cache'
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
if(curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
echo $response;
How to fix INVALID_PERMISSIONS_OR_MODEL_NOT_FOUND[edit]
Error message:
[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.
Solution: Verify the permissions of your API token.
- Navigate to the Airtable developer page on Authentication - Airtable Web API.
- From there, proceed to access token management.
- Review the permissions of your API token, such as access levels or scopes of bases.
How to fix INVALID_VALUE_FOR_COLUMN[edit]
Error message:
[type] => INVALID_VALUE_FOR_COLUMN [message] => Field "欄位名稱" cannot accept the provided value
Solution: Check the data type of field
- Go to the Airtable
- Select the field which met error e.g "欄位名稱" mentioned in the error message
- Menu: Edit field
- Choose the proper data type e.g. switch from "short line text" to "number"
If the data type of the field is a number and null values are allowed, you need to convert empty strings "" to NULL before writing to Airtable.
Example data: Input data of different data types, whether writing to Airtable is successful or the error message received.
| Field value | Instruction of field value | Single line text | Long text | Number (Decimal 1,0) | Number (Integer 2) |
|---|---|---|---|---|---|
| "" | Empty string | ok | ok | INVALID_VALUE_FOR_COLUMN | INVALID_VALUE_FOR_COLUMN |
| "0" or '0' | Quoted number | ok | ok | INVALID_VALUE_FOR_COLUMN | INVALID_VALUE_FOR_COLUMN |
| 0 | Number without double quote | INVALID_VALUE_FOR_COLUMN | INVALID_VALUE_FOR_COLUMN | ok | ok |
| 456 | Integer | INVALID_VALUE_FOR_COLUMN | INVALID_VALUE_FOR_COLUMN | ok | ok |
| 78.9 | Number with decimal point | INVALID_VALUE_FOR_COLUMN | INVALID_VALUE_FOR_COLUMN | ok | ok |
| NULL | NULL value | ok | ok | ok |
How to fix UNKNOWN_FIELD_NAME[edit]
Error message:
[type] => UNKNOWN_FIELD_NAME [message] => Unknown field name: "XXX"
Solution: Check the field name
- Navigate to your Airtable table.
- Verify that the specified field name ("XXX" in this case) exists in the table.
- If it doesn't, ensure you're using the correct field name in your query or action.
How to fix NOT_FOUND or INVALID_PERMISSIONS_OR_MODEL_NOT_FOUND[edit]
Error message:
(
[error] => NOT_FOUND
)
or
{
"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."
}
}
Solution: Check the URL of API
Further reading[edit]
- Introduction - Airtable Web API
- Airtable API Common Troubleshooting | Airtable Support
- Field Type overview | Airtable Support
- Development & APIs | Airtable Community
- Publish Blog version: 解決 Airtable API 常見問題
References[edit]
Troubleshooting of ...
- PHP, cUrl, Python, selenium, HTTP status code errors
- Database: SQL syntax debug, MySQL errors, MySQLTuner errors or PostgreSQL errors
- HTML/Javascript: Troubleshooting of javascript, XPath
- Software: Mediawiki, Docker, FTP problems, online conference software
- Test connectivity for the web service, Web Ping, Network problem, Web user behavior, Web scrape troubleshooting
Template