Get deployment
curl --request GET \
--url https://macaly.com/api/chat/{chatId}/deployment \
--header 'Authorization: Bearer <token>'import requests
url = "https://macaly.com/api/chat/{chatId}/deployment"
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}/deployment', 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}/deployment",
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}/deployment"
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}/deployment")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://macaly.com/api/chat/{chatId}/deployment")
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_bodyEndpoints
Get deployment
Verifica o estado da tentativa de publicação mais recente de um chat
GET
/
api
/
chat
/
{chatId}
/
deployment
Get deployment
curl --request GET \
--url https://macaly.com/api/chat/{chatId}/deployment \
--header 'Authorization: Bearer <token>'import requests
url = "https://macaly.com/api/chat/{chatId}/deployment"
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}/deployment', 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}/deployment",
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}/deployment"
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}/deployment")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://macaly.com/api/chat/{chatId}/deployment")
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_bodyVerifica o estado da tentativa de publicação mais recente de um chat, ou da tentativa indicada por
deploymentId. A tentativa mais recente pode ainda estar a compilar, ou pode ter falhado enquanto uma versão anterior continua no ar. Usa liveUrl para obter o URL da versão que está no ar agora. Se a implementação não estiver num estado final, este endpoint sincroniza o estado com a Vercel antes de responder.
Pedido
GET /api/chat/{chatId}/deployment
Cabeçalhos
| Cabeçalho | Obrigatório | Descrição |
|---|---|---|
Authorization | Sim | Bearer macaly_... |
Parâmetros de caminho
| Parâmetro | Tipo | Descrição |
|---|---|---|
chatId | string | O ID do chat |
Parâmetros de consulta
| Parâmetro | Obrigatório | Descrição |
|---|---|---|
deploymentId | Não | O id ou deploymentId devolvido por POST /deploy. Sem ele, o endpoint devolve a tentativa de publicação mais recente do chat. |
Exemplo de pedido
curl "https://www.macaly.com/api/chat/abc123/deployment?deploymentId=jzga0sttml37v6mbizb8tk1x" \
-H "Authorization: Bearer macaly_abc123..."
const response = await fetch(
`https://www.macaly.com/api/chat/${chatId}/deployment?deploymentId=${deploymentId}`,
{
headers: {
'Authorization': 'Bearer macaly_abc123...',
},
}
);
const data = await response.json();
console.log(data.status, data.liveUrl);
import requests
response = requests.get(
f'https://www.macaly.com/api/chat/{chat_id}/deployment',
params={'deploymentId': deployment_id},
headers={
'Authorization': 'Bearer macaly_abc123...',
},
)
data = response.json()
print(data['status'], data['liveUrl'])
Resposta
Implementação pronta
{
"id": "jzga0sttml37v6mbizb8tk1x",
"url": "https://macaly-staging-abc123.macaly.app",
"status": "READY",
"deploymentId": "dpl_HKLBd2QDTwq58AMUJiaMyUzk8WUw",
"createdAt": "2025-01-12T21:18:54.906Z",
"error": null,
"domain": "macaly-staging-abc123.macaly.app",
"domains": [
{
"domain": "macaly-staging-abc123.macaly.app",
"verified": true,
"isCustomDomain": false
}
],
"liveUrl": "https://macaly-staging-abc123.macaly.app"
}
Sem implementação
{
"id": null,
"url": null,
"status": null,
"deploymentId": null,
"createdAt": null,
"error": null,
"domain": null,
"domains": [
{
"domain": "macaly-staging-abc123.macaly.app",
"verified": true,
"isCustomDomain": false
}
],
"liveUrl": null
}
Implementação falhada
Uma republicação falhada mantém a versão anterior no ar, por isso oliveUrl continua preenchido.
{
"id": "jzga0sttml37v6mbizb8tk1x",
"url": "https://macaly-staging-abc123.macaly.app",
"status": "ERROR",
"deploymentId": "dpl_HKLBd2QDTwq58AMUJiaMyUzk8WUw",
"createdAt": "2025-01-12T21:18:54.906Z",
"error": ["Build failed: Module not found"],
"domain": "macaly-staging-abc123.macaly.app",
"domains": [],
"liveUrl": "https://macaly-staging-abc123.macaly.app"
}
Campos de resposta
| Campo | Tipo | Descrição |
|---|---|---|
id | string | null | ID da implementação na base de dados (null se nunca foi implementado) |
url | string | null | URL da implementação |
status | string | null | Estado da implementação na Vercel (ver abaixo) |
deploymentId | string | null | ID da implementação na Vercel |
createdAt | string | null | Data e hora (ISO) de criação da implementação |
error | string[] | null | Mensagens de erro caso a implementação tenha falhado |
domain | string | null | Domínio principal da implementação |
domains | array | Todos os domínios associados |
domains[].domain | string | Nome do domínio |
domains[].verified | boolean | Se o domínio está verificado |
domains[].isCustomDomain | boolean | Se é um domínio personalizado |
liveUrl | string | null | URL da versão no ar (null se nada estiver no ar) |
Valores de estado da implementação
| Estado | Descrição |
|---|---|
QUEUED | A implementação está em fila de espera |
BUILDING | A compilação está em curso |
READY | Implementação concluída com sucesso |
ERROR | A implementação falhou |
CANCELED | A implementação foi cancelada |
UNPUBLISHED | Removido da produção |
Códigos de estado
| Estado | Descrição |
|---|---|
| 200 | Sucesso (mesmo que não exista implementação, devolve campos nulos) |
| 401 | Chave API inválida ou em falta |
| 403 | O chat não pertence à tua equipa |
| 404 | Chat não encontrado, ou deploymentId não corresponde a nenhuma implementação deste chat |
Como acompanhar o progresso
Passa oid devolvido por POST /deploy como deploymentId.
while true; do
DEPLOYMENT=$(curl -s "https://www.macaly.com/api/chat/$CHAT_ID/deployment?deploymentId=$DEPLOYMENT_ID" \
-H "Authorization: Bearer macaly_...")
STATUS=$(echo $DEPLOYMENT | jq -r '.status')
echo "Status: $STATUS"
if [[ $STATUS == "READY" ]]; then
echo "Deployed: $(echo $DEPLOYMENT | jq -r '.liveUrl')"
break
elif [[ $STATUS == "ERROR" ]]; then
echo "Failed: $(echo $DEPLOYMENT | jq -r '.error')"
break
fi
sleep 3
done
Esta página foi útil?