Skip to main content
article_url = "https://api.airtable.com/v0/appxxxxxxxxxxx/articles/row_id?api_key=APIKEY"
data = {"fields" : {"contacted" : "hello world"}, "typecast":True}
patch_article_data = requests.patch(article_url, data=data)

I don’t understand why the above doesn’t work doing a patch request. I’ve tried many variations, including without typecast. I get the following response.


{u'error': {u'message': u'Invalid request: parameter validation failed. Check your request data.', u'type': u'INVALID_REQUEST_UNKNOWN'}}

I’m pretty sure a record ID is required for a PATCH.



In the example, row_id is the record_id. Should it be a param instead?


In the example, row_id is the record_id. Should it be a param instead?



Without a complete review of the underlying code I can only say that I think a PATCH payload (the data) must be an array of records to be updated.


Hi @Suraj_Kapoor - I’m assuming you are using the Python requests library here. This is some code that I implemented for a patch request:


api_url = 'https://api.airtable.com/v0/YOUR_APP_ID/YOUR_TABLE_NAME/' + id

headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR API KEY'
}

data = {
"fields": {
"your_field_name": "value"
}
}

response = requests.patch(api_url, headers=headers, json=data)

Looking at this post:




it recommends using the API key in the headers, rather than as a URL param. Try this, hopefully will work out for you.


JB


In the example, row_id is the record_id. Should it be a param instead?



As per the API docs for your base, the record id should be in the patch request URL:


curl -v -X PATCH https://api.airtable.com/v0/APP_ID_HERE/TABLE_NAM_HERE/rec123123123


Thank you! That did the trick. Appreciate your help


I am also facing the same issue that getting this error for patch request. I have added the API key in the header and the view in the query parameter but still getting the same error


I am also facing the same issue that getting this error for patch request. I have added the API key in the header and the view in the query parameter but still getting the same error


Did you pass the ID of the record you wanted to update? e.g.:


https://api.airtable.com/v0/APP_ID_HERE/TABLE_NAM_HERE/rec123123123


Note the record ID on the end, this is the record you want to update


Reply