Skip to content

Instantly share code, notes, and snippets.

@badosu
Last active August 29, 2015 14:28
Show Gist options
  • Save badosu/14e2775c41e243322783 to your computer and use it in GitHub Desktop.
Save badosu/14e2775c41e243322783 to your computer and use it in GitHub Desktop.

Criação de Vaga

Requisição

POST /available_jobs HTTP/1.1
Host: staging.presume.com.br
Accept: application/vnd.api+json;version=1
Content-Type: application/vnd.api+json
Authorization: Token token="3497f05b416f45eaa23ea1af3eb27536"
{
  "data": {
    "type": "available_jobs",
    "attributes": {
      "role": "Programador",
      "division": "TI",
      "description": "Precisamos de um programador",
      "questions_attributes": [
        { "sort_index": 0,
          "text": "Quanto é 1+1?",
          "duration": 120,
          "reading_duration": 20 },
        { "sort_index": 1,
          "text": "Quanto é 2+2?",
          "duration": 120,
          "reading_duration": 20 } ]
    }
  }
}

Resposta bem sucedida

HTTP/1.1 201 Created
{"data":{"type":"available_jobs","id":196}}

Exemplo de resposta de erro (autenticação)

HTTP/1.1 401 Unauthorized
{"errors":[{"title":"Bad Credentials"}]}

Criação de candidato

Requisição

POST /candidates HTTP/1.1
Host: staging.presume.com.br
Accept: application/vnd.api+json;version=1
Content-Type: application/vnd.api+json
Authorization: Token token="3497f05b416f45eaa23ea1af3eb27536"
{
  "data": {
    "type": "candidates",
    "attributes": {
      "name": "Candidato",
      "email": "[email protected]",
      "external_id": "999"
    },
    "relationships": {
      "available_job": {
        "data": { "type": "available_jobs", "id": "174" }
      }
    }
  }
}

Resposta bem sucedida

{
  "data": {
    "type": "candidates",
    "id":5281,
    "attributes": {
      "interview_login_url": "http://staging.presume.com.br/entrevista/login?invitation_code=d7ffc0436517d57dee888dd8dd9461f17b092aa8"
    }
  }
}

Retorno do callback de status

Os status a serem enviados são:

  • accepted_tos: leu as instruções e aceitou os termos de serviço
  • interview_started: iniciou a entrevista
  • interview_finished: finalizou a entrevista
  • retry_attempts_exceeded: candidato bloqueado por uso indevido

Exemplo do corpo de requisição

Apenas os status mudam, e apenas para o status interview_finished as urls são disponíveis.

{
  "data": {
    "type": "candidates",
    "id": 999,
    "attributes": {
      "external_id": "id-na-tua-plataforma",
      "status": "interview_finished",
      "rate_interview_url": "http://staging.presume.com.br/minha-conta/vagas/190/candidatos/5247"
      "share_interview_url": "http://staging.presume.com.br/entrevista/0c481c3cd01dedd2"
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment