Update collection

i update collection with api and i get ststus 200 but when i check on db nothing hapen…

Hi @moshe212,

Could you please provide some more info with screenshots / video? Based on your message it is quite difficult to guess what could be the problem.

The only thing I can think of now - sometimes the app builder interface “caches” the DB Collection values; did you try to reload it after API call?

Best regards, Victor.



that my code.
as you can see i send api update call for five element.
all api call with element id and i print to console log the resp and as you can see
i get 200 as a status.
but when i go to DB nothing changed… its stay false.

@Victor
Can you help me please?

Hi @moshe212,

Ok, I see. To start with: the field “ID” you’ve created is not related to the ID of the record in the collection. Adalo DB assigns its own internal IDs automatically, they are not available in the app builder, and they are unique (meaning if you delete an element with internal ID = 2, no any other element will get this ID in future).
So keep in mind that you need to get the record ID somehow before you update the element.

Then: why do you have comma ( , ) after “true” in your JSON payload? I might be wrong but as for me this is malformed JSON which could be interpreted incorrectly/result in errors.
Given my limited knowledge of javascript I don’t see any other errors here.

But to determine whether the problem is in the code, or the problem is with Adalo builder, or the problem is somewhere in Adalo’s backend, I’d suggest using Postman to test:

  • create the PUT request with the same content
  • create the GET request to get the record’s contents
  • run the 1st one and then the 2nd one, and see if the content returned is updated or not.

P.S. don’t forget to change your bearer token, as now it is exposed in the screenshot.

Best regards, Victor.

1 Like

@Victor
I understand.
now i have tow option:

  1. reset id of all collection.
  2. when i make custom action send the internal ID and not the field ID.

some of this options is possible? if it is, how?

Hi @moshe212,

With the limitation of internal IDs access, here is what I usually do:

  • add some property to the collection and make sure it will be unique during app usage (let’s call it NameID)
  • when I need to update something in Adalo DB from external script via API, I pass the value of this NameID to the script
  • then, I call GET ALL and filter the result by NameID == value I’ve passed.
  • as a result, I get a single record, from which I can extract internal RecordID and run a PUT request on the record.

Just wondering: was the problem related to comma? Have you tried to remove it?

By the way, I’ve created the feature request for exposing internal IDs to the builder, feel free to upvote: Make unique record IDs publicly available | Voters | Adalo

Best regards, Victor.

1 Like