Boleto Simples
agora é Kobana

Nos tornamos uma plataforma mais segura e eficiente, agora somos Kobana. Focada em tudo aquilo que você precisa, e portanto, focada totalmente em você!

Documentação da Kobana

Documentação para Desenvolvedores

Webhooks

Para saber mais sobre o funcionamento dos Webhooks, acesse a página de Webhooks.
Recurso Descrição
POST /api/v1/webhooks Criar webhook
GET /api/v1/webhooks/:id Informações do webhook
PATCH /api/v1/webhooks/:id Atualizar webhook
PUT /api/v1/webhooks/:id Atualizar webhook
GET /api/v1/webhooks Listar webhooks
DELETE /api/v1/webhooks/:id Excluir webhook

Modelo de Dados

Parâmetro Obrigatório Tipo Tamanho Descrição
id N/A Integer   ID do webhook
url Sim String 255 Endereço onde as requisições serão realizadas
content_type Não String 255 Content-type da requisição que será realizada. Valores válidos application/json (valor padrão) ou application/x-www-form-urlencoded.
events Não Array   Eventos que devem gerar notificações para o webhook. Ver possíveis valores na lista de eventos. O valor padrão é * (que representa todos os eventos atuais e futuros).
active Não Boolean   Define se o webhook estará ativo, recebendo notificações. O valor padrão é true.
ssl_verification_enabled N/A Boolean   Define se a verificação SSL está habilitada no webhook.
bank_billet_account_id Não Integer   ID da Carteira de Cobrança. Se informado, o webhook apenas receberá notificações de eventos relacionados à carteira indicada.

Criar webhook

POST /api/v1/webhooks

Exemplo de requisição inválida

Bash
Requisição:
curl -i \
-H "Authorization: Bearer $BOLETOSIMPLES_TOKEN" \
-d '{"webhook":{}}' \
-H 'Content-Type: application/json' \
-H 'User-Agent: MyApp (myapp@example.com)' \
-X POST 'https://api-sandbox.kobana.com.br/v1/webhooks'
Resposta:
HTTP/1.1 422 Unprocessable Entity
Date: Fri, 17 Oct 2014 18:39:47 GMT
Status: 422 Unprocessable Entity
Content-Type: application/json; charset=utf-8
...

{
  "errors": {
    "webhook": [
      "não pode ficar em branco"
    ]
  }
}

Exemplo de requisição válida

Bash
Requisição:
curl -i \
-H "Authorization: Bearer $BOLETOSIMPLES_TOKEN" \
-d '{"webhook":{"url":"https://example.com/callbacks/boletosimples/"}}' \
-H 'Content-Type: application/json' \
-H 'User-Agent: MyApp (myapp@example.com)' \
-X POST 'https://api-sandbox.kobana.com.br/v1/webhooks'
Resposta:
HTTP/1.1 201 Created
Date: Fri, 17 Oct 2014 19:30:06 GMT
Status: 201 Created
Location: https://api-sandbox.kobana.com.br/v1/customers/1
Content-Type: application/json; charset=utf-8
...

{
  "id": 1,
  "url": "https://example.com/callbacks/boletosimples/",
  "content_type": "application/json",
  "events": [
    "*"
  ],
  "ssl_verification_enabled": true,
  "active": true,
  "bank_billet_account_id": null
}

Informações do webhook

GET /api/v1/webhooks/:id

Exemplo

Bash
Requisição:
curl -i \
-H "Authorization: Bearer $BOLETOSIMPLES_TOKEN" \
-H 'Content-Type: application/json' \
-H 'User-Agent: MyApp (myapp@example.com)' \
-X GET 'https://api-sandbox.kobana.com.br/v1/webhooks/1'
Resposta:
HTTP/1.1 200 OK
Date: Fri, 17 Oct 2014 19:46:16 GMT
Status: 200 OK
Content-Type: application/json; charset=utf-8
...

{
  "id": 1,
  "url": "https://example.com/callbacks/boletosimples/",
  "content_type": "application/json",
  "events": [
    "bank_billet.generated"
  ],
  "ssl_verification_enabled": true,
  "active": true,
  "bank_billet_account_id": 2
}

Atualizar webhook

PATCH /api/v1/webhooks/:id ou PUT /api/v1/webhooks/:id

Exemplo de requisição inválida

Bash
Requisição:
curl -i \
-H "Authorization: Bearer $BOLETOSIMPLES_TOKEN" \
-d '{"webhook":{"url": ""}}' \
-H 'Content-Type: application/json' \
-H 'User-Agent: MyApp (myapp@example.com)' \
-X PATCH 'https://api-sandbox.kobana.com.br/v1/webhooks/1'
Resposta:
HTTP/1.1 422 Unprocessable Entity
Date: Fri, 17 Oct 2014 18:39:47 GMT
Status: 422 Unprocessable Entity
Content-Type: application/json; charset=utf-8
...

{
  "errors": {
    "url": [
      "não pode ficar em branco",
      "não é válida."
    ]
  }
}

Exemplo de requisição válida

Bash
Requisição:
curl -i \
-H "Authorization: Bearer $BOLETOSIMPLES_TOKEN" \
-d '{"webhook":{"url":"https://example.com/callbacks/boletosimples/"}}' \
-H 'Content-Type: application/json' \
-H 'User-Agent: MyApp (myapp@example.com)' \
-X PATCH 'https://api-sandbox.kobana.com.br/v1/webhooks/1'
Resposta:
HTTP/1.1 204 No Content
Date: Fri, 17 Oct 2014 19:30:06 GMT
Status: 204 No Content
Location: https://api-sandbox.kobana.com.br/v1/webhooks/1
...

Listar webhooks

GET /api/v1/webhooks

Parâmetro Obrigatório Tipo Descrição
page Não Number Número da Página
per_page Não Number Quantidade de registros por página

Exemplo

Bash
Requisição:
curl -i \
-H "Authorization: Bearer $BOLETOSIMPLES_TOKEN" \
-H 'Content-Type: application/json' \
-H 'User-Agent: MyApp (myapp@example.com)' \
-X GET "https://api-sandbox.kobana.com.br/v1/webhooks?page=1&per_page=2"
Resposta:
HTTP/1.1 200 OK
Date: Fri, 17 Oct 2014 19:46:16 GMT
Status: 200 OK
Link: <https://api-sandbox.kobana.com.br/v1/webhooks?page=2&per_page=2>; rel="last", <https://api-sandbox.kobana.com.br/v1/webhooks?page=2&per_page=2>; rel="next"
Total: 4
Content-Type: application/json; charset=utf-8
...

[
  {
    "id": 5,
    "url": "https://example.com/callbacks/boletosimples/",
    "content_type": "application/json",
    "events": [
      "bank_billet.generated"
    ],
    "ssl_verification_enabled": true,
    "active": true,
    "bank_billet_account_id": 2
  }
]

Excluir webhook

DELETE /api/v1/webhooks/:id

Exemplo

Bash
Requisição:
curl -i \
-H "Authorization: Bearer $BOLETOSIMPLES_TOKEN" \
-H 'User-Agent: MyApp (myapp@example.com)' \
-X DELETE 'https://api-sandbox.kobana.com.br/v1/webhooks/1'
Resposta:
HTTP/1.1 204 No Content
Date: Fri, 17 Oct 2014 19:30:06 GMT
Status: 204 No Content
...