{
  "info": {
    "_postman_id": "viddy-public-api-v1",
    "name": "Viddy Public API",
    "description": "Collection oficial da Viddy Public API. Inclui exemplos prontos para todos os endpoints.\n\n**Antes de começar:**\n1. Defina as variáveis `client_id` e `client_secret` no environment\n2. Rode 'Auth - Get Token' — isso popula automaticamente a variável `access_token`\n3. Os demais requests usam `{{access_token}}` automaticamente",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://api.sandbox.viddy.com.br/public/v1",
      "type": "string"
    },
    {
      "key": "client_id",
      "value": "",
      "type": "string"
    },
    {
      "key": "client_secret",
      "value": "",
      "type": "string"
    },
    {
      "key": "access_token",
      "value": "",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "Autenticação",
      "item": [
        {
          "name": "POST /auth/token",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "if (pm.response.code === 200) {",
                  "  const json = pm.response.json();",
                  "  pm.collectionVariables.set('access_token', json.access_token);",
                  "  console.log('access_token salvo:', json.access_token.substring(0, 20) + '...');",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": {
              "type": "noauth"
            },
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"grant_type\": \"client_credentials\",\n  \"client_id\": \"{{client_id}}\",\n  \"client_secret\": \"{{client_secret}}\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/auth/token",
              "host": ["{{base_url}}"],
              "path": ["auth", "token"]
            }
          }
        },
        {
          "name": "GET /auth/me",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/auth/me",
              "host": ["{{base_url}}"],
              "path": ["auth", "me"]
            }
          }
        },
        {
          "name": "GET /ping",
          "request": {
            "auth": {
              "type": "noauth"
            },
            "method": "GET",
            "url": {
              "raw": "{{base_url}}/ping",
              "host": ["{{base_url}}"],
              "path": ["ping"]
            }
          }
        }
      ]
    }
  ]
}
