Make sure to change API_KEY_USERNAME and API_KEY_PASSWORD with the proper credentials obtained from IoTFlows console. These credentials can be either one of these options:
A Device API Key that has permission to interact with the resources available in its project, or
An Organization IoT API Key that can have read-only or read/write permissions to the entire organization resources
A User Client that is authorized to interact with the permitted resources of the user. This option is most useful when you need to build a web or mobile app. For this option, you need to register your Application in IoTFlows and authenticate users using OAuth2. With the obtained JWT, you can perform a Basic authentication HTTP request to generate a User Client.
Publish data stream
To publish a real-time data stream, you need to pass these parameters in a json object: