Managing topics

Creating a topic

You can create topics with the REST API in a similar manner to the topic creation methods in Diffusion client SDKs.

Add Topic API

Endpoint

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

Content-type

application/json

Method

POST

curl --include                                          \
     --request POST                                     \
     --url https://api.diffusion.cloud/topics/add       \
     --header 'authorization: Bearer <TOKEN>'           \
     --header 'content-type: application/json'          \
     -d '{"path":"my-topic", "type":"json",
          "properties":{ "VALIDATE_VALUES":"true" }
         }'
Add Topic parameters
Parameter Whether Optional Description

path

No

The path at which the topic must be added

type

Yes

The type of topic. The default value is json

properties

Yes

A map of topic properties. The default value is {}

Add Topic response status
200 The topic was added successfully (or already exists)

400

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

500

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

Removing topics

You can remove a single topic, or multiple topics using a topic selector.

Remove Topic API

Endpoint

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

Content-type

application/json

Method

POST

curl --include                                              \
     --request POST                                         \
     --url https://api.diffusion.cloud/topics/remove        \
     --header 'authorization: Bearer <TOKEN>'               \
     --header 'content-type: application/json'              \
     -d '{"path":"my-topic"}'
Remove Topic parameters
Parameter Optional? Default Description

path

Yes

The Diffusion topic path as a string.
It is mandatory to provide either the path or the selector.

selector

Yes

The Diffusion topic selector as a string.
It is mandatory to provide either the path or the selector.

Remove Topic response status
Code Description

200

Topics removed successfully

400

There was a problem removing the topics due to the parameters supplied. See message for more details

500

There was an unexpected problem removing the topics. See message for more details