İçeriğe geç
ajan.io

Belgeler menüsü

Bu sayfada

Beceri Dosyasını Al

Saklanan bir Beceri dosyasını yola göre al

Saklanan bir Skill dosyasını çalışma alanınızdan yola göre alır.

Temel URL

https://api.ajan.io/skills/v1/{skillId}/files

Özel dağıtımlar Tüm isteklerde api.ajan.com'yı /api/public ile değiştirin.

Gerekli Kapsamlar

Bu uç nokta SKILL_API kapsamını gerektirir.

Beceriye izleyici erişimi gerektirir.

Parametreler

ParametreTürGerekliAçıklama
skillIddizeEvetAlınacak Yeteneğin UUID'si.
pathdizeEvetBeceri içindeki dosyanın göreceli yolu, örneğin references/template.md. Maksimum: 255 karakter. Mutlak yollar, sürücü öneki yolları, kontrol karakterleri ve .. bölümleri reddedilir.

Dosya geçerli UTF-8 olmalı ve 512 KB'tan büyük olmamalıdır. Okunabilir uzantılar şunlardır: .md, .mdx, .txt, .py, .sh, .js, .ts, .json, .yaml, .yml, .toml, .csv, .xml, .xsd, .html, .css ve .svg. İkili dosyalar ve diğer desteklenmeyen dosyalar Get Skill üzerinde listelenmeye devam eder. Bu uç nokta içeriklerini döndürmez.

Örnek

javascript
const axios = require("axios");

async function getSkillFile(skillId, path) {
  const response = await axios.get(
    `https://api.ajan.io/skills/v1/${skillId}/files`,
    {
      params: { path },
      headers: {
        Authorization: "Bearer YOUR_API_KEY"
      }
    }
  );

  console.log("Content:", response.data.content);
}

getSkillFile(
  "550e8400-e29b-41d4-a716-446655440000",
  "references/template.md"
);

Yanıt Formatı

Başarılı Yanıt (200 Tamam)

typescript
{
  path: string;
  sizeBytes: number;
  extension: string;
  hasScript: boolean;
  sha256: string;
  content: string;
}

Hata İşleme

Durum KoduAçıklama
400Geçersiz Beceri Kimliği, geçersiz yol, desteklenmeyen dosya türü, geçersiz UTF-8 veya 512 KB'tan büyük dosya
401Geçersiz veya eksik API anahtarı
403SKILL_API kapsamı veya Beceriler ürün erişimi eksik
404Beceri veya dosya bulunamadı veya erişilemiyor
429Oran sınırı aşıldı
500Dahili sunucu hatası

ajan, API anahtarınızı korumak ve uygulamalarınızın güvende kalmasını sağlamak için tarayıcı kaynaklı istekleri kasıtlı olarak engeller. Daha fazla bilgi için lütfen API Key Best Practices hakkındaki kılavuzumuza bakın.

OpenAPI

openapi: 3.0.0
info:
  title: ajan API
  version: 3.0.0
servers:
  - url: https://api.ajan.io
    description: Production
security:
  - bearerAuth: []
paths:
  /skills/v1/{skillId}/files:
    get:
      tags:
        - Skills
      summary: Get a Skill file
      description: Retrieves a stored Skill file by path from your workspace.
      operationId: getSkillFile
      parameters:
        - $ref: '#/components/parameters/SkillId'
        - name: path
          in: query
          required: true
          description: Relative path of the file inside the Skill.
          schema:
            type: string
            minLength: 1
            maxLength: 255
      responses:
        '200':
          description: File returned successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SkillFileContent'
        '400':
          description: >-
            Invalid Skill ID, invalid path, unsupported file type, invalid
            UTF-8, or file larger than 512 KB
        '401':
          description: Invalid or missing API key
        '403':
          description: Missing required scope or access
        '404':
          description: Skill or file not found
        '429':
          description: Rate limit exceeded
        '500':
          description: Internal server error
components:
  parameters:
    SkillId:
      name: skillId
      in: path
      required: true
      description: UUID of the Skill.
      schema:
        type: string
        format: uuid
  schemas:
    SkillFileContent:
      allOf:
        - $ref: '#/components/schemas/SkillFile'
        - type: object
          required:
            - content
          properties:
            content:
              type: string
              description: UTF-8 file contents.
    SkillFile:
      type: object
      required:
        - path
        - sizeBytes
        - extension
        - hasScript
        - sha256
      properties:
        path:
          type: string
          description: Relative path inside the Skill.
        sizeBytes:
          type: integer
          description: File size in bytes.
        extension:
          type: string
          description: Lowercase file extension, including the leading dot.
        hasScript:
          type: boolean
          description: Whether the file is a script file (`.py`, `.sh`, `.js`, or `.ts`).
        sha256:
          type: string
          description: Lowercase SHA-256 hash of the original file bytes.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: API key as Bearer token. Format "Bearer YOUR_API_KEY"