Using curl commands for setting various tenant options
You can set or change various tenant options by sending
POST requests to
Cumulocity IoT. This topic explains how you can do this using the curl command-line tool. See
https://curl.haxx.se/ for detailed information on curl. See also the information on tenants in the
Reference guide at
https://www.cumulocity.com/guides/.
The syntax of the curl command depends on the environment in which you are working. The syntax for a Bash UNIX shell, for example, is as follows:
curl --user username -X POST -H 'Content-Type: application/json' -d '{"category": "analytics.builder", "key": "keyname", "value": "value"}' -k https://hostname/tenant/options
where:
username is the name of a user who has ADMIN permission for "Option management" in
Cumulocity IoT. curl will prompt for a password. Or you can provide a password in the
username argument by appending it with a colon (:) and the password. For example:
--user User123:secretpw
If your tenant does not have its own unique host name, you have to provide the tenant identifier in the username argument. For example:
--user management/User123
or
--user t12345/User123
keyname is one of the keys listed in the previous topics.
value is the value that is to be set for the key, which can be a number or a string, depending on the key.
hostname is the host name of your tenant where your user application is deployed.
The
category is always
analytics.builder.
For example (Bash shell):
curl --user User123 -X POST -H 'Content-Type: application/json' -d '{"category": "analytics.builder", "key": "numWorkerThreads", "value": "4"}' -k https://mytenant/tenant/options