Can't update relationship via adalo api

Hello, everybody!

Have some truble with Adalo API!

I try to update row in Adalo Collection via API.

I see in docs Body Schema for PUT requests:

Also in Docs i see body example:
{
“Service Time Slots”: [
1,
2,
3
],
“Status”: “string”
}

Then i try to PUT Data by this schema i get 200 Response.

For “Status” everything fine. I see new value in collection.

But for “Service Time Slots”(relationship) nothing happens. Where are no changes in collection!

What am i doing wrong?

Does anybody have successful experience with changing relationship via Adalo API?

1 Like

I have the same problem - did you find a solution to this @Kostya?

Hi @berwickgeek,

My experiments show that it is possible to update relationship only for the record which has the “unique” part. E.g if user have several slots, slot belongs to one user - then it’s possible to update relationship field for the slot (change user-owner).
But I didn’t manage to update user (assign another array of slots).

The logic is similar to the one in DB console in Adalo.

Best regards, Victor.

2 Likes

This is a game changer for me - thanks so much @Victor. Just tested it and it’s working like you said.

1 Like

@berwickgeek what is interesting - it is possible to update Many-to-Many relationships via API.
Tested it just now - works perfectly, using an array in JSON.

I wonder why updating one-to-many from “one” side isn’t possible.

Best regards, Victor.

Hey, using the example you have with the user and the slot, ‘user’ does not appear in the API documentation of the slot (However, an array of ‘slots’ does appear in the user documentation). Are you sure you can update the ‘user’ for a slot even tho ‘user’ does not appear in the API documentation?

Hi Yan @ybierens,

I’m not sure I get your question.
You can update relationships via API (although it is not documented therefore I can’t confirm that it’s officially supported - you need to check it with Adalo directly).
It is possible to update M2M relationships by updating the relationship property in a collection with an array of IDs of the “reciprocal” collection.
Also it’s possible to update 1:M relationships, in a “many” collection, choosing which “one” you’d like to connect.

Best,
Victor.