Kuyruk
Yayın kuyruğu, belirli günler ve saatler için önceden tanımlanmış zaman slotlarına gönderileri otomatik olarak atar. “Her Salı 10:00 ve Perşembe 14:00’te yayınla” gibi tekrar eden programlar oluşturabilirsiniz.
Kuyruk Oluştur
POST/v1/queue
Yeni bir yayın kuyruğu tanımı oluşturur.
İstek Gövdesi
| Alan | Tip | Zorunlu | Varsayılan | Açıklama |
|---|---|---|---|---|
name | string | Evet | — | Kuyruk adı (maks. 100 karakter) |
description | string | Hayır | — | Kuyruk açıklaması |
mode | string | Hayır | sync | sync (tüm platformlara aynı anda) veya per_platform |
timezone | string | Hayır | Europe/Istanbul | Zaman dilimi |
workspaceId | string | Hayır | — | Hedef workspace (belirtilmezse ilk aktif workspace) |
slots | object[] | Hayır | — | Zaman slotları |
slots[].dayOfWeek | integer | Evet | — | Haftanın günü (0=Pazar, 1=Pazartesi, …, 6=Cumartesi) |
slots[].localTime | string | Evet | — | Yayın saati — HH:MM formatı |
slots[].socialAccountId | string | Hayır | — | Belirli bir hesaba pin etmek için |
Kod Örnekleri
Node.js
kuyruk-olustur.js
const response = await fetch('https://api.sosyalkopru.com/v1/queue', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.SOSYALKOPRU_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Haftalık Instagram Programı',
description: 'Salı ve Perşembe sabah postları',
timezone: 'Europe/Istanbul',
slots: [
{ dayOfWeek: 2, localTime: '10:00' }, // Salı 10:00
{ dayOfWeek: 2, localTime: '18:00' }, // Salı 18:00
{ dayOfWeek: 4, localTime: '10:00' }, // Perşembe 10:00
{ dayOfWeek: 4, localTime: '16:00' }, // Perşembe 16:00
],
}),
})
const { data } = await response.json()
console.log('Kuyruk oluşturuldu:', data.id)
console.log(`${data.slots.length} slot tanımlandı`)Başarılı Yanıt (201 Created)
{
"success": true,
"data": {
"id": "q_01HZGK9P3QABC",
"workspaceId": "ws_01HZGK9P3QABC",
"name": "Haftalık Instagram Programı",
"description": "Salı ve Perşembe sabah postları",
"mode": "sync",
"timezone": "Europe/Istanbul",
"isActive": true,
"isPaused": false,
"slots": [
{ "id": "slot_01XYZ", "dayOfWeek": 2, "localTime": "10:00", "socialAccountId": null },
{ "id": "slot_02XYZ", "dayOfWeek": 2, "localTime": "18:00", "socialAccountId": null },
{ "id": "slot_03XYZ", "dayOfWeek": 4, "localTime": "10:00", "socialAccountId": null },
{ "id": "slot_04XYZ", "dayOfWeek": 4, "localTime": "16:00", "socialAccountId": null }
],
"createdAt": "2025-06-10T12:00:00.000Z"
},
"meta": { "requestId": "req_01XYZ", "timestamp": "...", "version": "1" }
}Kuyrukları Listele
GET/v1/queue
Query Parametreleri
| Parametre | Tip | Varsayılan | Açıklama |
|---|---|---|---|
page | integer | 1 | Sayfa numarası |
perPage | integer | 20 | Sayfa başına kayıt (maks: 50) |
workspaceId | string | — | Workspace filtresi |
active | boolean | — | true / false |
Node.js
kuyruk-listele.js
const response = await fetch('https://api.sosyalkopru.com/v1/queue?active=true', {
headers: { 'Authorization': `Bearer ${process.env.SOSYALKOPRU_API_KEY}` },
})
const { data } = await response.json()
data.forEach(q => {
const pausedStr = q.isPaused ? ' [DURAKLADI]' : ''
console.log(`${q.name}${pausedStr} — ${q.slotCount} slot, ${q.pendingEntries} bekleyen`)
})Kuyruk Detayı
GET/v1/queue/{id}
Node.js
kuyruk-detay.js
const response = await fetch(
`https://api.sosyalkopru.com/v1/queue/${queueId}`,
{ headers: { 'Authorization': `Bearer ${process.env.SOSYALKOPRU_API_KEY}` } }
)
const { data } = await response.json()
console.log(`${data.name} — ${data.isPaused ? 'DURAKLADI' : 'AKTİF'}`)Kuyruk Güncelle / Duraklat
PATCH/v1/queue/{id}
Kuyruk adını, slotlarını güncelleyin veya kuyruğu duraklatın/devam ettirin.
İstek Gövdesi
| Alan | Tip | Açıklama |
|---|---|---|
name | string | Yeni kuyruk adı |
description | string | Yeni açıklama |
isPaused | boolean | true ile duraklat, false ile devam et |
pausedReason | string | Duraklatma nedeni (opsiyonel) |
slots | object[] | Slotları tamamen yeniler (mevcut slotlar silinir) |
Node.js
kuyruk-guncelle.js
// Kuyruğu duraklat
const pauseResponse = await fetch(
`https://api.sosyalkopru.com/v1/queue/${queueId}`,
{
method: 'PATCH',
headers: {
'Authorization': `Bearer ${process.env.SOSYALKOPRU_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
isPaused: true,
pausedReason: 'Bayram tatili nedeniyle geçici durduruldu',
}),
}
)
// Kuyruğu devam ettir
const resumeResponse = await fetch(
`https://api.sosyalkopru.com/v1/queue/${queueId}`,
{
method: 'PATCH',
headers: {
'Authorization': `Bearer ${process.env.SOSYALKOPRU_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ isPaused: false }),
}
)Kuyruk Sil
DELETE/v1/queue/{id}
Node.js
await fetch(`https://api.sosyalkopru.com/v1/queue/${queueId}`, {
method: 'DELETE',
headers: { 'Authorization': `Bearer ${process.env.SOSYALKOPRU_API_KEY}` },
})Kuyruk Girdilerini Listele
GET/v1/queue/{id}/entries
Kuyruktaki gönderileri sıralı olarak döner.
Query Parametreleri
| Parametre | Tip | Açıklama |
|---|---|---|
status | string | pending scheduled locked published failed paused cancelled |
Node.js
kuyruk-girdiler.js
const response = await fetch(
`https://api.sosyalkopru.com/v1/queue/${queueId}/entries?status=pending`,
{ headers: { 'Authorization': `Bearer ${process.env.SOSYALKOPRU_API_KEY}` } }
)
const { data } = await response.json()
data.forEach((e, i) => {
console.log(`${i + 1}. ${e.post.title ?? e.post.id} [${e.status}]`)
if (e.assignedPublishAt) {
console.log(` Yayın: ${new Date(e.assignedPublishAt).toLocaleString('tr-TR')}`)
}
})Başarılı Yanıt
{
"success": true,
"data": [
{
"id": "entry_01HZGK9P3QABC",
"queueId": "q_01HZGK9P3QABC",
"postId": "post_01HZGK9P3QABC",
"post": {
"id": "post_01HZGK9P3QABC",
"title": "Ürün Lansmanı",
"content": "Heyecan verici bir haberimiz var...",
"status": "draft"
},
"orderIndex": 1,
"status": "pending",
"assignedPublishAt": "2025-06-17T07:00:00.000Z",
"lockedAt": null,
"createdAt": "2025-06-10T12:00:00.000Z"
}
],
"meta": { "requestId": "req_01XYZ", "timestamp": "...", "version": "1" },
"pagination": { "page": 1, "perPage": 20, "total": 8, "totalPages": 1 }
}Kuyruğa Gönderi Ekle
POST/v1/queue/{id}/entries
Mevcut bir gönderiyi kuyruğa ekler.
İstek Gövdesi
| Alan | Tip | Zorunlu | Açıklama |
|---|---|---|---|
postId | string | Evet | Kuyruğa eklenecek gönderi ID’si |
orderIndex | integer | Hayır | Sıra indeksi (belirtilmezse sona eklenir) |
Node.js
kuyrug-girdi-ekle.js
const response = await fetch(
`https://api.sosyalkopru.com/v1/queue/${queueId}/entries`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.SOSYALKOPRU_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ postId: 'post_01HZGK9P3QABC' }),
}
)
const { data } = await response.json()
console.log('Eklendi:', data.id, '— Sıra:', data.orderIndex)Duraklatılmış (isPaused: true) bir kuyruğa gönderi eklenemez — 409 Conflict hatası döner.
Kuyruk Girdisi Sil
DELETE/v1/queue/{id}/entries/{entryId}
await fetch(
`https://api.sosyalkopru.com/v1/queue/${queueId}/entries/${entryId}`,
{
method: 'DELETE',
headers: { 'Authorization': `Bearer ${process.env.SOSYALKOPRU_API_KEY}` },
}
)Girdi Statüleri
| Statü | Açıklama |
|---|---|
pending | Bir sonraki uygun slota atanmayı bekliyor |
scheduled | Belirli bir slota atandı, yayın zamanı belli |
locked | Yayın yaklaşıyor, değişiklik kilitlendi |
published | Başarıyla yayınlandı |
failed | Yayın başarısız oldu |
paused | Kuyruk duraklatıldığı için beklemeye alındı |
cancelled | İptal edildi |
Haftanın Günleri
| Değer | Gün |
|---|---|
0 | Pazar |
1 | Pazartesi |
2 | Salı |
3 | Çarşamba |
4 | Perşembe |
5 | Cuma |
6 | Cumartesi |
Last updated on