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
1
curl -X POST \
2
https://streams.marsview.ai/rb/v1/streams/setup_realtime_stream \
3
-H 'authorization: Bearer <ATUHTOKEN>' \
4
-H 'cache-control: no-cache' \
5
-H 'content-type: application/json' \
6
-d '{
7
"channels":"2",
8
"modelConfigs" : {"intent_analysis":{ "intents":[] }, "custom_statement_tag_analysis":{"statement_tag_ids":[], "use_tag_level_threshold":True}}
9
}'
Copied!

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.
1
{
2
"status": true,
3
"data": {
4
"userId": "[email protected]",
5
"txnId": "txn-6sm91fi3vku2m3fh8-1632744795931",
6
"channels": [
7
{
8
"channelId": "channel-6sm91fi3vku2m3fh9-1632744795931"
9
},
10
{
11
"channelId": "channel-6sm91fi3vku2m3fha-1632744795931"
12
}
13
]
14
}
15
}
Copied!

Model config format

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.
1
// example format
2
//config data for intents and statement tag models had to be created and the ids are given here, for which apis are available
3
model_configs = {
4
"intent_analysis":{
5
"intents":[
6
// "intent-1c6q62hzkxj2farq-1640270029382",
7
// "intent-1c6q62hzkxj4gm3m-1640273449953"
8
]
9
},
10
"custom_statement_tag_analysis":{
11
"statement_tag_ids":[
12
// "statement-bxllq5imjkx68e6tb-1639493995007",
13
// "statement-bxllq1zsuzkvuj44go-1636609624728",
14
],
15
"use_tag_level_threshold":True
16
},
17
}
Copied!
Last modified 17d ago