Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Oct 16, 2023 09:04 AM
I am trying to make a very simply patch request using an HTTP module in Make.com. However, I'm getting this and can't work out why:
I can easily achieve this using curl:
edwardnewton@Edwards-MacBook-Pro Downloads % curl -X PATCH \
"https://api.airtable.com/v0/appzYqJSdNkXvYunc/2023/rec1e8DfKYXPzWJev" \
-H "Authorization: Bearer xxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"fields": {
"PDF Requested": true
}
}'
{"id":"rec1e8DfKYXPzWJev","createdTime":"2023-10-12T00:55:02.000Z","fields":{"Name":"MOLLY SEIDEL","Finish Time":"02:23:07","Bib":114,"Pos":60,"Marathon ID":"recquo4BsycGtqNH2","recordId":"rec1e8DfKYXPzWJev","Year":"2023","Title":"THE CHICAGO MARATHON","Distance":"26.2M","Link":"https://pbposters.com/products/the-chicago-marathon?racer_id=rec1e8DfKYXPzWJev&base=appzYqJSdNkXvYun...","PDF Requested":true}}%
Has anyone got any ideas or how to debug?
Solved! Go to Solution.
Oct 17, 2023 06:03 AM
FYI managed to get it working. Can't be certain but I'm pretty sure it was due to whitespace in the the body of my json.🙄 Pretty irritating how something so trivial can hold you up for days. Surely there's got to be smarter ways of debugging stuff like this than endless guess work. anyway, sorted!
Oct 16, 2023 09:53 AM
Have you tried using Make's native Airtable modules instead of writing your own code?
Oct 16, 2023 11:50 AM
Hi Scott, appreciate the quick reply..and yes, the issue with the airtable modules in Make (for my use case) is that there's no option to map the base. I need to dynamically update. I just really struggling to dubug - any ideas?
Oct 16, 2023 12:40 PM
You said it works with CURL... can you get it to work properly in Postman?
If so, post 2 screenshots below: (1) How you've got it setup in Postman, and (2) How you've got it setup in Make's HTTP "Make A Request" module. Documentation on this page.
Oct 17, 2023 04:59 AM - edited Oct 17, 2023 05:03 AM
Oct 17, 2023 05:43 AM
You didn't show a screenshot of how you setup your HTTP module in Make, but you don't want to be sending all those different headers to Airtable. You only want to send the authorization & the content-type in the header.
Here is Airtable's REST API documentation on how to update a record in Airtable -- check out the sample request in the right margin: https://airtable.com/developers/web/api/update-record
Oct 17, 2023 06:03 AM
FYI managed to get it working. Can't be certain but I'm pretty sure it was due to whitespace in the the body of my json.🙄 Pretty irritating how something so trivial can hold you up for days. Surely there's got to be smarter ways of debugging stuff like this than endless guess work. anyway, sorted!
Oct 17, 2023 06:10 AM
It's possible that it was improper whitespace! In Make's HTTP documentation, they suggest running your JSON code through a JSON validator such as https://jsonlint.com/ to make sure that your JSON is valid.
Also, I would remove all the extraneous headers from your API request to make sure that it continues to work flawlessly in the future.