curl --request POST \
--url https://api.sandbox.asapp.com/generativeagent/v1/streams \
--header 'Content-Type: application/json' \
--header 'asapp-api-id: <api-key>' \
--header 'asapp-api-secret: <api-key>' \
--data '
{
"streamId": "97555020-0276-435f-8104-c378221ba292"
}
'import requests
url = "https://api.sandbox.asapp.com/generativeagent/v1/streams"
payload = { "streamId": "97555020-0276-435f-8104-c378221ba292" }
headers = {
"asapp-api-id": "<api-key>",
"asapp-api-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'asapp-api-id': '<api-key>',
'asapp-api-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({streamId: '97555020-0276-435f-8104-c378221ba292'})
};
fetch('https://api.sandbox.asapp.com/generativeagent/v1/streams', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.asapp.com/generativeagent/v1/streams",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'streamId' => '97555020-0276-435f-8104-c378221ba292'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"asapp-api-id: <api-key>",
"asapp-api-secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.asapp.com/generativeagent/v1/streams"
payload := strings.NewReader("{\n \"streamId\": \"97555020-0276-435f-8104-c378221ba292\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("asapp-api-id", "<api-key>")
req.Header.Add("asapp-api-secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.asapp.com/generativeagent/v1/streams")
.header("asapp-api-id", "<api-key>")
.header("asapp-api-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"streamId\": \"97555020-0276-435f-8104-c378221ba292\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.asapp.com/generativeagent/v1/streams")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["asapp-api-id"] = '<api-key>'
request["asapp-api-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"streamId\": \"97555020-0276-435f-8104-c378221ba292\"\n}"
response = http.request(request)
puts response.read_body{
"streamId": "97555020-0276-435f-8104-c378221ba292",
"streamingUrl": "https://ws-co82129c.test.asapp.com/push-api/connect/sse\\?token\\=<token>",
"messageTypes": [
"generative-agent-message"
]
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "400-01",
"message": "Bad request"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "401-01",
"message": "Unauthorized"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "500-01",
"message": "Internal server error"
}
}Create stream URL
This API creates a generative agent event streaming URL to start a streaming connection (SSE).
This API should be called when the client boots-up to request a streaming_url, before it calls endpoints whose responses are delivered asynchronously (and most likely before calling any other endpoint).
Provide the streamId to reconnect to a previous stream.
curl --request POST \
--url https://api.sandbox.asapp.com/generativeagent/v1/streams \
--header 'Content-Type: application/json' \
--header 'asapp-api-id: <api-key>' \
--header 'asapp-api-secret: <api-key>' \
--data '
{
"streamId": "97555020-0276-435f-8104-c378221ba292"
}
'import requests
url = "https://api.sandbox.asapp.com/generativeagent/v1/streams"
payload = { "streamId": "97555020-0276-435f-8104-c378221ba292" }
headers = {
"asapp-api-id": "<api-key>",
"asapp-api-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'asapp-api-id': '<api-key>',
'asapp-api-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({streamId: '97555020-0276-435f-8104-c378221ba292'})
};
fetch('https://api.sandbox.asapp.com/generativeagent/v1/streams', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.asapp.com/generativeagent/v1/streams",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'streamId' => '97555020-0276-435f-8104-c378221ba292'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"asapp-api-id: <api-key>",
"asapp-api-secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.asapp.com/generativeagent/v1/streams"
payload := strings.NewReader("{\n \"streamId\": \"97555020-0276-435f-8104-c378221ba292\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("asapp-api-id", "<api-key>")
req.Header.Add("asapp-api-secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.asapp.com/generativeagent/v1/streams")
.header("asapp-api-id", "<api-key>")
.header("asapp-api-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"streamId\": \"97555020-0276-435f-8104-c378221ba292\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.asapp.com/generativeagent/v1/streams")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["asapp-api-id"] = '<api-key>'
request["asapp-api-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"streamId\": \"97555020-0276-435f-8104-c378221ba292\"\n}"
response = http.request(request)
puts response.read_body{
"streamId": "97555020-0276-435f-8104-c378221ba292",
"streamingUrl": "https://ws-co82129c.test.asapp.com/push-api/connect/sse\\?token\\=<token>",
"messageTypes": [
"generative-agent-message"
]
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "400-01",
"message": "Bad request"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "401-01",
"message": "Unauthorized"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "500-01",
"message": "Internal server error"
}
}Body
The parameters to be associated with a given connection.
streamId to be associated with the streaming connection. If not present, the llm-bot will provide one.
"97555020-0276-435f-8104-c378221ba292"
Response
Successfully generated a new streaming URL.
Streaming URL with its identifier and possible SSE message-types to be received.
If it was provided in the request, this field will just reaffirm the value. Otherwise, a newly generated one will be provided.
"97555020-0276-435f-8104-c378221ba292"
URL for opening the SSE session. It may be used once, and is valid for only 30 seconds.
"https://ws-co82129c.test.asapp.com/push-api/connect/sse\\?token\\=<token>"
Possible message types to be received from the agent.
["generative-agent-message"]
Was this page helpful?