Skip to content

Commit 731637d

Browse files
committed
fixup: add docs up map set operationC
1 parent bcb0230 commit 731637d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/pages/docs/liveobjects/rest-api-usage.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,26 @@ The following example creates a new `LiveMap` instance and assigns it to the `po
556556
```
557557
</Code>
558558

559+
The following example shows how to update a key and value in a `LiveMap`:
560+
561+
<Code>
562+
```shell
563+
curl -X POST "https://main.realtime.ably.net/channels/my-channel/object" \
564+
-u {{API_KEY}} \
565+
-H "Content-Type: application/json" \
566+
-d '{
567+
"operation": "MAP_SET",
568+
"path": "posts.post1",
569+
"data": {
570+
"key" : "title",
571+
"value": {"string": "LiveObjects is still awesome"}
572+
}
573+
}'
574+
```
575+
</Code>
576+
577+
Note in this example if the key `title` didn't exist it would have been created and set by this operation.
578+
559579
When using the `path` specifier with a `COUNTER_CREATE` or `MAP_CREATE` operation, the server constructs *two* operations which are published as a [batch](#batch-operations):
560580

561581
* A `MAP_CREATE` or `COUNTER_CREATE` operation used to create the new object

0 commit comments

Comments
 (0)