Endpoints
Implementatie ophalen
Haal de status op van de nieuwste publicatiepoging voor een chat
GET
/api/chat/{chatId}/deploymentHaalt de status op van de nieuwste publicatiepoging voor een chat, of van de poging die deploymentId aanwijst. De nieuwste poging kan nog bezig zijn met bouwen, of kan mislukt zijn terwijl een oudere versie live blijft. Gebruik liveUrl voor de URL van de versie die nu live is. Als de implementatie niet in een eindstatus is, synchroniseert dit endpoint de status met Vercel voordat het antwoordt.
Verzoek
GET /api/chat/{chatId}/deploymentHeaders
| Header | Vereist | Beschrijving |
|---|---|---|
Authorization | Ja | Bearer macaly_... |
Padparameters
| Parameter | Type | Beschrijving |
|---|---|---|
chatId | string | De chat-ID |
Queryparameters
| Parameter | Vereist | Beschrijving |
|---|---|---|
deploymentId | Nee | De id of deploymentId die POST /deploy heeft geretourneerd. Zonder deze parameter retourneert het endpoint de nieuwste publicatiepoging van de chat. |
Voorbeeldverzoek
curl "https://www.macaly.com/api/chat/abc123/deployment?deploymentId=jzga0sttml37v6mbizb8tk1x" \
-H "Authorization: Bearer macaly_abc123..."Respons
Implementatie gereed
{
"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"
}Geen implementatie
{
"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
}Implementatie mislukt
Een mislukte herpublicatie laat de vorige versie live staan, dus liveUrl blijft ingevuld.
{
"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"
}Responsvelden
| Veld | Type | Beschrijving |
|---|---|---|
id | string | null | Database-implementatie-ID (null als nooit geïmplementeerd) |
url | string | null | De implementatie-URL |
status | string | null | Vercel-implementatiestatus (zie hieronder) |
deploymentId | string | null | Vercel-implementatie-ID |
createdAt | string | null | ISO-tijdstempel van de implementatiecreatie |
error | string[] | null | Foutmeldingen als de implementatie is mislukt |
domain | string | null | Primair domein voor de implementatie |
domains | array | Alle gekoppelde domeinen |
domains[].domain | string | Domeinnaam |
domains[].verified | boolean | Of het domein is geverifieerd |
domains[].isCustomDomain | boolean | Of dit een aangepast domein is |
liveUrl | string | null | URL van de live versie (null als er niets live is) |
Implementatiestatuswaarden
| Status | Beschrijving |
|---|---|
QUEUED | Implementatie staat in de wachtrij |
BUILDING | Build is bezig |
READY | Implementatie geslaagd |
ERROR | Implementatie mislukt |
CANCELED | Implementatie geannuleerd |
UNPUBLISHED | Implementatie gedepubliceerd |
Statuscodes
| Status | Beschrijving |
|---|---|
| 200 | Succes (zelfs als er geen implementatie bestaat, retourneert null-velden) |
| 401 | Ongeldige of ontbrekende API-sleutel |
| 403 | Chat behoort niet tot uw team |
| 404 | Chat niet gevonden, of deploymentId komt niet overeen met een implementatie van deze chat |
Pollingpatroon
Geef de id die POST /deploy heeft geretourneerd door als 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