Set a topic value
You can set and update the value of a topic with the REST API.
Endpoint |
|
Content-type |
|
Method |
|
Required scope(s) |
|
curl --include \
--request POST \
--url https://api.diffusion.cloud/topics/set \
--header 'authorization: Apikey <TOKEN>' \
--header 'content-type: application/json' \
-d '{"path":"my-existing-topic", "type":"json", "value": {"foo": "bar"}}'
| Parameter | Optional? | Default | Description |
|---|---|---|---|
path |
No |
— |
The Diffusion topic path as a string. |
value |
No |
— |
The value to set the topic to. |
type |
Yes |
json |
The type of topic. This can be either json or string. |
| Code | Description |
|---|---|
|
The topic was updated successfully (or already has the value supplied). |
|
There was a problem updating the topic due to the parameters supplied. See |
|
There was an unexpected problem updating the topic. See |
This endpoint never creates a topic - if no topic exists at path, the request fails with 400. See Add and set a topic value to create-or-update in a single call.
|
Further reading
This endpoint is a thin wrapper around the JavaScript client SDK’s own topic update method - see TopicUpdate.set in the JavaScript SDK reference for more detail on how value updates and constraints work at the client level.