SDK For Data Streaming
Rest API
5min
rest api integration to stream data use the instructions below to stream data to qualetics for analytics and/or source data for data machines rest api host sandbox https //mqdev qualetics com live https //mq qualetics com/api/token token based authentication generate the jwt token using the endpoint below endpoint /api/token authorization basic authentication method get params application id this will be the unique id for the application that will be streaming the data multiple application ids can be generated for the same account application secret password for the application result access token header based authentication access the api key, secret and client instance id from your portal go to admin > integration >api keys select the client & application if you have setup multiple applications if a client instance or application is not present in the dropdown, the step to setup the application and client instance has likely not been completed please complete the following steps before accessing the api keys adding applications docid 8nnpcio3wdbhihjfpa8yk adding client instances docid\ maxh2t qj4jykyi qarn5 going live docid\ yuos evgre81ztel8fwdi note this feature is only accessible to users setup as admins access app key, app secret and client instance id app key your account key app secret your account secret client instance id unique id for the combination of client instance and application created send data data can be sent to qualetics in the form of events to the qualetics message broker please follow the instructions below to stream the data using a rest api post the api below will support jwt token based authentication as well as header based authentication refer to the code examples below endpoint /api/sendmessage authorization bearer \<access token> method post params client id this should be the name or the unique identifier of your client in a multi tenant setup for whom you are sending the data if you do not have a multi tenant setup then this value can be skipped required for multi tenant setup body this contains the main message content that should be passed to the api the message should be formatted as a json structure similar to the js sdk for each event see example body content below result confirmation message example code with token based authentication var settings = { "url" "https //mqdev qualetics com/api/sendmessage", "method" "post", "timeout" 0, "headers" { "authorization" "bearer \<access token>", "content type" "application/json" }, "data" json stringify({ "actor" { "type" "student", "id" 127, "attributes" { "student" { "name" "test user" } } }, "action" { "name" "new user" }, "context" { "name" "new user", "attributes" { "position" "accountant", "department" "accounting", "location" "new york" } }, "metadata" { "localtimestamp" "2022 01 26 13 40 47 288356", "useragent" "none" } }) }; $ ajax(settings) done(function (response) {console log(response);}); example code with header based authentication var settings = { "url" "https //mq qualetics com/api/sendmessage", "method" "post", "timeout" 0, "headers" { "x app id" "\<app id>", "x app secret" "\<app secret>", "x client instance" "\<client instance id>", "content type" "application/json" }, "data" json stringify({ "actor" { "type" "system", "id" "system" }, "action" { "name" "new product" }, "context" { "name" "product management", "attributes" { "category" "electronics" } }, "object" { "name" "mobile phone", "type" "portable device", "attributes" { "id" 1234, "description" "this is a test mobile phone ", "indexforsearch" true //required for ai based search and indexing } }, "result" "none", "metadata" { "localtimestamp" "2022 01 26 13 40 47 288356", "useragent" "none" } }), }; $ ajax(settings) done(function (response) { console log(response); });