Assets V2
Buscar por URL
Encontre um asset a partir de qualquer variante de URL com sanitização e cache.
POST /api/externalAPIs/public/assets/findByUrl
Busca um asset pela URL na base de dados. Aceita qualquer uma das variantes: file_url, bucket_url, short_original ou short_minio.
Autenticação: Bearer Token (API Key)
Exemplo cURL (rápido)
curl -X POST https://api.tolky.to/api/externalAPIs/public/assets/findByUrl \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/file.pdf",
    "useCache": true,
    "includeDeleted": false,
    "checkUrl": false
  }'
Payload
{
  "url": "https://example.com/file.pdf",
  "useCache": true,
  "includeDeleted": false,
  "checkUrl": false
}
Parâmetros
- url(string, obrigatório): URL a ser verificada
- useCache(boolean, opcional): Se deve usar cache. Padrão:- true
- includeDeleted(boolean, opcional): Incluir assets deletados. Padrão:- false
- checkUrl(boolean, opcional): Executa Health Check no link. Padrão:- false
Respostas
200 - Encontrado
{
  "exists": true,
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z",
    "bucket_url": "https://minio.tolky.to/assets/file.pdf",
    "file_url": "https://example.com/file.pdf",
    "host_id": "660e8400-e29b-41d4-a716-446655440000",
    "type": "document",
    "mime_type": "application/pdf",
    "short_original": "https://short.tolky.to/abc123",
    "short_minio": "https://short.tolky.to/xyz789",
    "deleted": false
  }
}
200 - Não encontrado
{
  "exists": false,
  "data": null
}
200 - Encontrado com Health Check (checkUrl: true)
{
  "exists": true,
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z",
    "bucket_url": "https://minio.tolky.to/assets/file.pdf",
    "file_url": "https://example.com/file.pdf",
    "host_id": "660e8400-e29b-41d4-a716-446655440000",
    "type": "document",
    "mime_type": "application/pdf",
    "short_original": "https://short.tolky.to/abc123",
    "short_minio": "https://short.tolky.to/xyz789",
    "deleted": false,
    "healthCheck": {
      "url": "https://example.com/file.pdf",
      "ok": true,
      "status": 200,
      "mimeType": "application/pdf",
      "type": "document"
    }
  }
}
Veja detalhes do objeto de Health Check em Health Check.
Observações
- A URL é sanitizada antes da busca
- Resultados podem usar cache (TTL ~5min)
- Variantes aceitas: file_url,bucket_url,short_original,short_minio