Create Transaction

Create a transaction by specifying the number of channels and the model configuration that has to run for these channels. This API will return a transaction ID along with channel IDs, these channel ID

Request

Given below is an example request for creating a new transaction ID using a Marsview AUTHTOKEN. Details for generating Marsview AUTHTOKEN can be found here: generate-token
Param
Description
channels
The number of channels that this transaction will contain. Channel is the number of input sources that would be accessing the real time API. If you want to people to get real time analytics using the same transaction ID, provide the channels key as 2. This value will default to 1 if this parameter is not specified
modelConfig
The configuration input to the models is given here as a json object. The models such as intents and custom statement tags will require this configuration. How to generate this config is explained in Overview.
Bash
curl -X POST \
https://streams.marsview.ai/rb/v1/streams/setup_realtime_stream \
-H 'authorization: Bearer <ATUHTOKEN>' \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-d '{
"channels":"2",
"modelConfigs" : {"intent_analysis":{ "intents":[] }, "custom_statement_tag_analysis":{"statement_tag_ids":[], "use_tag_level_threshold":True}}
}'

Response

When a request for a transaction is made with the number of Channel ID's. You will get the following response. The response includes the Channel IDs which can be used to initate a stream.
{
"status": true,
"data": {
"userId": "[email protected]",
"txnId": "txn-6sm91fi3vku2m3fh8-1632744795931",
"channels": [
{
"channelId": "channel-6sm91fi3vku2m3fh9-1632744795931"
},
{
"channelId": "channel-6sm91fi3vku2m3fha-1632744795931"
}
]
}
}

Configuring models

The custom input to the models is given in the config along with other flags. The contexts to be detected are saved in database and id's are generated for the same. Those contexts that are needed to be identified, its respective id's are given as part of model config while initiating the stream. The models that require these id's are intents and custom statement tag models. How to generate the id's is explained in Overview.
All model are enabled by default and users can disable some of the model by specifying the enabled flag as False
// example format
//config data for intents and statement tag models had to be created and the ids are given here, for which apis are available
model_configs = {
"intent_analysis":{
"enabled": "true",
"intents":[
// "intent-1c6q62hzkxj2farq-1640270029382",
// "intent-1c6q62hzkxj4gm3m-1640273449953"
]
},
"custom_statement_tag_analysis":{
"enabled": "false",
"statement_tag_ids":[
// "statement-bxllq5imjkx68e6tb-1639493995007",
// "statement-bxllq1zsuzkvuj44go-1636609624728",
],
"use_tag_level_threshold":"true"
},
}