Set a topic value

You can set and update the value of a topic with the REST API.

Set topic value API

Endpoint

https://api.diffusion.cloud/topics/set

Content-type

application/json

Method

POST

Required scope(s)

rest-api/set

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"}}'
Set topic value parameters
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.

Set topic value response status
Code Description

200

The topic was updated successfully (or already has the value supplied).

400

There was a problem updating the topic due to the parameters supplied. See message for more details

500

There was an unexpected problem updating the topic. See message for more details

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.