Trigger güncelle
Bir entegrasyondaki mevcut bir trigger'ı güncelleyin
Bir entegrasyondaki mevcut bir trigger'ı günceller. Bu, trigger yapılandırmasını sağlanan değerlerle değiştirir.
Base URL
https://api.ajan.io/integrations/v1/{integrationId}/triggers/{triggerId}Dedicated deployments Tüm isteklerde
api.ajan.com'u/api/publicile değiştirin.
Required Scopes
Bu endpoint INTEGRATION_API kapsamı gerektirir.
Parameters
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
integrationId | string | Yes | Entegrasyonun UUID'si |
triggerId | string | Yes | Güncellenecek trigger'ın UUID'si |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Trigger adı (maks. 100 karakter) |
description | string | No | Trigger açıklaması (maks. 90 karakter) |
pollingCode | string | No | Yeni olaylar için polling yapan JavaScript kodu (maks. 1.000 karakter) |
inputFields | array | No | Trigger yapılandırması için giriş alanları |
Tam giriş alanı şeması için Create Trigger sayfasına bakın.
Example
javascript
const axios = require("axios");
async function updateTrigger(integrationId, triggerId) {
const response = await axios.put(
`https://api.ajan.io/integrations/v1/${integrationId}/triggers/${triggerId}`,
{
name: "New Issue Created v2",
description: "Updated trigger with additional filtering options",
pollingCode: `
const response = await ld.request({
method: "GET",
url: "https://api.example.com/v2/issues",
headers: {
Authorization: "Bearer " + data.auth.apiToken
},
params: {
since: new Date(Date.now() - 60 * 60 * 1000).toISOString(),
project: data.input.projectId
}
});
return response.json;
`,
inputFields: [
{
label: "Project ID",
type: "TEXT",
required: true
},
{
label: "Status Filter",
type: "SELECT",
options: [
{ label: "All", value: "all" },
{ label: "Open", value: "open" },
{ label: "Closed", value: "closed" }
],
required: false
}
]
},
{
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
}
);
console.log("Updated trigger:", response.data.trigger);
}
updateTrigger("550e8400-e29b-41d4-a716-446655440000", "660e8400-e29b-41d4-a716-446655440001");Response Format
Success Response (200 OK)
typescript
{
trigger: {
id: string;
name: string;
slug: string;
description: string;
type: string;
pollingCode: string | null;
inputFields: Array<{
slug: string;
label: string;
type: string;
description: string;
placeholder: string | null;
required: boolean;
options: Array<{label: string, value: string}> | null;
allowMultiSelect: boolean | null;
}>;
};
}Error Handling
| Status Code | Description |
|---|---|
| 400 | Geçersiz istek gövdesi veya ID'ler |
| 401 | Geçersiz veya eksik API anahtarı |
| 403 | Bu entegrasyona erişim yok |
| 404 | Entegrasyon veya trigger bulunamadı |
| 429 | Rate limit aşıldı |
ajan, API anahtarınızı korumak ve uygulamalarınızın güvenliğini sağlamak için tarayıcı kaynaklı istekleri bilinçli olarak engeller. Daha fazla bilgi için API Key Best Practices kılavuzuna bakın.