Get status
curl --request GET \
--url https://macaly.com/api/chat/{chatId}/status \
--header 'Authorization: Bearer <token>'import requests
url = "https://macaly.com/api/chat/{chatId}/status"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://macaly.com/api/chat/{chatId}/status', 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://macaly.com/api/chat/{chatId}/status",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://macaly.com/api/chat/{chatId}/status"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://macaly.com/api/chat/{chatId}/status")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://macaly.com/api/chat/{chatId}/status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyEndpoint'ler
Get status
Bir sohbet işleminin durumunu takip edin
GET
/
api
/
chat
/
{chatId}
/
status
Get status
curl --request GET \
--url https://macaly.com/api/chat/{chatId}/status \
--header 'Authorization: Bearer <token>'import requests
url = "https://macaly.com/api/chat/{chatId}/status"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://macaly.com/api/chat/{chatId}/status', 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://macaly.com/api/chat/{chatId}/status",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://macaly.com/api/chat/{chatId}/status"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://macaly.com/api/chat/{chatId}/status")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://macaly.com/api/chat/{chatId}/status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyBir sohbet işleminin durumunu takip edin. Bir sohbetin işlemini tamamlayıp tamamlamadığını, açık bir stream bağlantısı sürdürmeye gerek kalmadan kontrol etmek için kullanışlıdır.
İstek
GET /api/chat/{chatId}/status
Başlıklar
| Header | Zorunlu | Açıklama |
|---|---|---|
Authorization | Evet | Bearer macaly_... |
Yol parametreleri
| Parametre | Tür | Açıklama |
|---|---|---|
chatId | string | POST /api/chat isteğinden dönen sohbet kimliği |
Örnek istek
curl https://www.macaly.com/api/chat/abc123/status \
-H "Authorization: Bearer macaly_abc123..."
const response = await fetch(
`https://www.macaly.com/api/chat/${chatId}/status`,
{
headers: {
'Authorization': 'Bearer macaly_abc123...',
},
}
);
const data = await response.json();
console.log(data.status);
import requests
response = requests.get(
f'https://www.macaly.com/api/chat/{chat_id}/status',
headers={
'Authorization': 'Bearer macaly_abc123...',
},
)
data = response.json()
print(data['status'])
Yanıt
{
"chatId": "abc123",
"url": "https://www.macaly.com/chat/abc123",
"status": "completed",
"result": {
"content": "Here's what I built for you..."
}
}
Yanıt alanları
| Alan | Tür | Açıklama |
|---|---|---|
chatId | string | Sohbet kimliği |
url | string | Sohbeti tarayıcıda görüntülemek için URL |
status | string | Geçerli işlem durumu (aşağıya bakın) |
result.content | string | Nihai asistan mesajı (yalnızca completed olduğunda) |
error.message | string | Hata açıklaması (yalnızca failed olduğunda) |
Durum değerleri
| Durum | Açıklama |
|---|---|
running | İşlem şu anda çalışıyor |
completed | Başarıyla tamamlandı |
failed | Bir hatayla karşılaşıldı |
cancelled | İşlem manuel olarak iptal edildi |
no_active_workflow | Bu sohbet için aktif bir işlem yok |
Durum kodları
| Durum | Açıklama |
|---|---|
| 200 | Başarılı |
| 401 | Geçersiz veya eksik API anahtarı |
| 403 | Sohbet ekibinize ait değil |
| 404 | Sohbet bulunamadı |
Durum takibi deseni
while true; do
STATUS=$(curl -s https://www.macaly.com/api/chat/$CHAT_ID/status \
-H "Authorization: Bearer macaly_...")
echo "Status: $(echo $STATUS | jq -r .status)"
if echo "$STATUS" | grep -q '"status":"completed"'; then
echo "Done!"
break
fi
sleep 2
done
Sonraki adımlar
Durumcompleted olduğunda şunları yapabilirsiniz:
- Uygulamayı dağıtın -
POST /api/chat/{chatId}/deploy
Bu sayfa yararlı mıydı?