Updating a single record - not updating

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,

The page and Update Record flow looks like…

If I edit the colour to Green, and tap the Save button, no save occurs - why not?

The Update Record custom object looks like…
image

The Alert attached to the Update Record error node reports (on the phone) a ‘JSON error INVALID REQUEST UNKNOWN’.

How can I get Update Record to work?

Hi!

Have you checked in the Data tab that the Update Record (PUT) method is enabled, configured and if you test it, does it work correctly?

Hi Mevi
I had not thought of testing the PUT definition.
So when I go to do that I entered the id as you can see

image

but where do I put in the Record Properties?
I was stumped before, this time I tried the {} and then ‘Object with Properties’, then

image

Is this the correct thing to do? I get an error message
image

What does this mean?

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.

Mevi, thank you for that.

I changed the above to…
image

but I get when I test…

So I am still puzzled.

I have now tried testing the Delete (with a static id) in my AirTable, the results are below. I would love to get on top of these CRUD operations.

PS I replaced the 1 in the id of the above UPDATE with a genuine record id, recPhH0eMrG2T6MSj, but the result is the same .

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.

Hi Mevi

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)

Airtable DELETE request and response

image

Airtable CREATE request

Airtable CREATE response

Airtable UPDATE request

Airtable UPDATE response

!

@Bruce_X

Hey there!

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 :slight_smile:

I put in fields as a list of any values so it can be flexibly substituted with the data you want to post.

Let us know how it goes!

1 Like

Hi Akseli

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 …
image
This needs to be changed but is not mentioned in any of the tutorials. It needs to be changed to…
image
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?

Yours Kindly
BruceX

Hey there!

Sorry for the delay in responses.

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:

 { 
  "records": [
     {
        "fields": {
                    "Rego":
                    "Make": 
                     ...
         }

Let us know if this helps or if you were able to solve this already!