Araç Güncelle

Mevcut bir aracı güncelleyin

Endpoint

PUT/api/v1/tools/:toolId

Mevcut bir aracın adını, açıklamasını veya konfigürasyonunu günceller.

URL Parametreleri

toolIdstring (gerekli)

Güncellenecek aracın ID'si

İstek Parametreleri

Tüm parametreler opsiyoneldir. Sadece güncellemek istediğiniz alanları gönderin.

namestring

Aracın yeni adı

descriptionstring

Aracın yeni açıklaması

configobject

Güncellenmiş konfigürasyon (mevcut config ile birleştirilir)

İstek Örnekleri

Sadece İsmi Güncelleme

cURL
curl -X PUT https://api.wespoke.ai/api/v1/tools/tool_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "CRM Sorgu (Güncel)"
  }'

Konfigürasyon Güncelleme

cURL
curl -X PUT https://api.wespoke.ai/api/v1/tools/tool_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "config": {
      "query": {
        "expand": "details,segments"
      }
    }
  }'

Çoklu Alan Güncelleme

cURL
curl -X PUT https://api.wespoke.ai/api/v1/tools/tool_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "CRM Müşteri Sorgu",
    "description": "CRM API'sinden detaylı müşteri bilgisi çeker",
    "config": {
      "url": "https://api.crm.local/v2/customers/{id}",
      "query": {
        "expand": "details,segments,history"
      }
    }
  }'

Yanıt Örneği

200 OK
{
  "success": true,
  "data": {
    "id": "tool_abc123",
    "name": "CRM Müşteri Sorgu",
    "type": "API_REQUEST",
    "description": "CRM API'sinden detaylı müşteri bilgisi çeker",
    "config": {
      "url": "https://api.crm.local/v2/customers/{id}",
      "method": "GET",
      "headers": {
        "Authorization": "Bearer {{secrets.CRM_API_KEY}}"
      },
      "query": {
        "expand": "details,segments,history"
      }
    },
    "createdAt": "2024-01-14T09:00:00Z",
    "updatedAt": "2024-01-16T14:30:00Z"
  }
}

Önemli Notlar

• Araç tipi (type) güncellenemez. Farklı bir tip kullanmak için yeni araç oluşturun.

• Config objesi mevcut konfigürasyon ile birleştirilir (deep merge).

• Belirli bir config alanını silmek için null değeri gönderin.

• Güncellenmiş araç kullanan asistanlar otomatik olarak yeni konfigürasyonu kullanır.

Hata Yanıtları

404 Not Found
{
  "success": false,
  "error": {
    "code": "TOOL_NOT_FOUND",
    "message": "Araç bulunamadı"
  }
}
400 Bad Request
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Geçersiz güncelleme",
    "details": {
      "config.url": "Geçersiz URL formatı"
    }
  }
}