Hi, I have now gone thru most of the tutorials, some twice, and I cannot find one that covers ‘Update Record’. So I tried working it out. Can you please tell me where the below is going wrong.
I have a data variable, ‘atVehicles’, linked to Air Table, defined on this page as ‘Single Record’. The page successfully gets data for the correct record, based on an id stored in another data variable (client side) called csVehicle_id.Vehicle_id - all good so far.
Each Input Field on this page is bound to a field in atVehicles,
Ah, don’t reference any page/app/data variables in the data editor, use just static values, since those variables only work in the app itself (the data editor should not allow using those values). So just add static texts/numbers into each field to test it out.
Uhhhh ok I have never used Airtable, so I don’t really know much, but it looks like the format you’re trying to perform the PUT and DELETE is wrong. The DELETE says that instead of an id you need a records array with the ids, I assume as records:[{id:1}] or similar. Perhaps the record format is something you need or the PUT as well? Check from Airtable or try to search on the forums or online how to configure PUT/DELETE for Airtable.
I only picked airtable because it is popular with your users. But which REST API do you use (and therefore is well tested). I am happy to swap. Anyway I will explore further. Airtable does document the requests it needs very well, I will let you know in case you are interested.
Note: the GET and GET COLLECTION work well with Appgyver and Airtable.
(btw, I do not mind my keys being exposed in this forum, this is a test database)
So the problem you have here is basically that you need to get Composer to make a request similar to the ones in the CURL examples you posted.
As for DELETE requests, Airtable documentation says:
You can also issue a DELETE request to the record endpoint to delete a single record.
So being that your GET RECORD request works, you should be able to delete records by making a similar request but instead as a DELETE.
The one in your example is the other DELETE endpoint which is for deleting multiple records. You could use it but it requires encoding and sending an array of data which can get a bit complicated.
For CREATE from the example we can see that Airtable expects the request to have an object like:
{
"records": [
{
"fields": {
...
But in your screenshots you’re sending an object formatted as:
{
“id”: 1
“fields”: [
“Make”: “Fiat”
…
To remedy this I suggest you get rid of the id in the CREATE request and use a custom schema to format it according to the Airtable example
There was just enough of a hint in your reply, whew!. The answer (to the delete) turned out to be as follows
On the Delete Record’s Config tab I had left the default value as is …
This needs to be changed but is not mentioned in any of the tutorials. It needs to be changed to…
Its a subtle difference but it makes a world of difference.
Now my delete works in the Test tab, lets see if it works in the App?
And yes it does, Delete Successful.
Now, the CU of CRUD,
I tried to follow your hint about creating a custom schema, and I found where it is done, but what properties to put there, I could not guess.
Can you please help?? With the create and the update?
As for what properties to put in the schema within the property “fields”, you should follow the properties of the Airtable CREATE request example you posted a screenshot of: