Requisições MiniGestao

De MSTECH wiki
Ir para: navegação, pesquisa

Índice

Documentação - requisições CRUD

(Chrome) Postman - REST Client shortcut

<Link> POST Header: Content-Type, Value: application/json

Raw – Json <send>


Chamada

tipo requisição ===Get===, GetAll

Get

===Save===, Edit, Delete POST




Como buscar paginado no postman:

<link> GET

Header Value (exemplo) Descrição Content-Type application/json cabeçalho json PageSize 2 tamanho da página. se não colocar nada, por padrão é 10. CurrentPage 0 página que será exibida. a primeira página é 0 SortField Name nome do campo do json que será ordenado o resultado. sem aspas. Case Sensitive! Diferencia maiúscula de minúscula! SortDir asc ou desc ordenação ascendente ou descendente. colocar “asc” ou “desc” sem aspas. por padrão é “asc”.

Além disso, este resultado retorna via response, mais alguns headers, em especial 2 campos:


Header Value (exemplo) Descrição TotalPages 7 Total de páginas que essa busca possui, baseado no tamanho da página e contagem de registros. X-RecordsCount 19 Total de registros da página.

Escola

GetAll

http://localhost:52439/Escola/GetAll

Retorno:

http://pastebin.com/YN5LHScH  

Get

http://localhost:52439/Escola/Get?id=1

Retorno:

http://pastebin.com/rVW5iicC 

GetByDocente

http://localhost:52439/Escola/GetByDocente?pes_id=df97ba73-762e-e611-80c9-00155d000d82

Retorno:

http://pastebin.com/7L0zjHpj 

Save

http://localhost:52439/Escola/Save

Entrada:

http://pastebin.com/qn2we6Zg

Retorno:

http://pastebin.com/BaZvYbe4 

Edit

http://localhost:52439/Ano/Edit

Entrada:

http://pastebin.com/i5EvfG56

Delete

http://localhost:52439/Escola/Delete?id=5

Ano

Get

http://localhost:52439/Ano/GetAll http://pastebin.com/g2tBHFNn

GetAll

http://localhost:52439/Ano/Get?id=20 http://pastebin.com/Zdhh858P

Save

http://localhost:52439/Ano/Save

Entrada:

http://pastebin.com/AUqXGM2Z

Retorno:

http://pastebin.com/ix9Wd49H 

Edit

http://localhost:52439/Ano/Edit

Entrada:

http://pastebin.com/PShwpPxq

Delete

http://localhost:52439/Ano/Delete?id=10

Pessoa

GetAll

http://localhost:52439/Pessoa/GetAll

Retorno:

http://pastebin.com/yUNpYfPX 

Get

busca dados da pessoa + usuário do Core passando o pes_id (Guid):

http://localhost:52439/Pessoa/Get?pes_id=772c60e0-bcdf-e511-80bf-e894f602060a

Retorno:

http://pastebin.com/FXb4LYKG 

Aluno

GetAll

http://localhost:52439/Aluno/GetAll

Retorno:

http://pastebin.com/qYkFN8zC 

Obs: Traz sem os dados de Responsável para diminuir a carga do banco

Get

busca pelo ID do banco do mini-gestão (AlunoId: int) http://localhost:52439/Aluno/Get?id=4

Retorno:

http://pastebin.com/sW46sZ0Q 

GetByTurma

http://localhost:52439/Aluno/GetByTurma?id=1

Retorno:

http://pastebin.com/m39EgUet 

GetByCoreSSO

busca aluno tanto pelo pes_id quanto pelo usu_id, ambos são opcionais, mas pelo menos 1 precisa ser obrigatório para retornar um resultado:

(por usu_id_coresso) http://localhost:52439/Aluno/GetByCoreSSO?usu_id=4cbe2fa1-452f-e611-80c9-00155d000d82

(por pes_id_coresso) http://localhost:52439/Aluno/GetByCoreSSO?pes_id=b32daff9-732e-e611-80c9-00155d000d82

Retorno:

http://pastebin.com/RaaFEuEd

Save

cria novo aluno, retornando os id’s do mesmo http://localhost:52439/Aluno/Save

Entrada:

http://pastebin.com/7muwer6b

Retorno:

http://pastebin.com/vRc0j93e  

Edit

===Edit===a sem retorno http://localhost:52439/Aluno/Edit

Entrada:

http://pastebin.com/tYQyUPBa

Delete

http://localhost:52439/Aluno/Delete?id=3

Docente

GetAll

http://localhost:52439/Docente/GetAll

Retorno:

http://pastebin.com/Bqfi7Jhp 

Get

Busca pelo ID do miniGestão (docenteId : int)

http://localhost:52439/Docente/Get?id=3

GetByTurma

http://localhost:52439/Docente/GetByTurma?id=1

Retorno:

http://pastebin.com/BzmSSNHW 

GetByCoreSSO

busca docente tanto pelo pes_id quanto pelo usu_id, ambos são opcionais, mas pelo menos 1 precisa ser obrigatório para retornar um resultado:

(por usu_id_coresso) http://localhost:52439/Docente/getByCoreSSO?usu_id=e757577e-762e-e611-80c9-00155d000d82

(por pes_id_coresso) http://localhost:52439/Docente/getByCoreSSO?pes_id=e657577e-762e-e611-80c9-00155d000d82

Retorno:

http://pastebin.com/UnCmUv2F


Save

cria novo aluno, retornando os id’s do mesmo

http://localhost:52439/Docente/Save

Entrada:

http://pastebin.com/zgeiH0EN

Retorno:

http://pastebin.com/R0PAYzb6 

Edit

===Edit===a sem retorno http://localhost:52439/Docente/Edit

Entrada:

http://pastebin.com/feunYBkZ

Delete

http://localhost:52439/docente/Delete?id=1

Caderneta

GetAll

http://localhost:52439/caderneta/getall

Retorno:

http://pastebin.com/nPdcmGuM  

Get

http://localhost:52439/caderneta/get?id=2

Retorno:

http://pastebin.com/PgyGsEVa 

Save

http://localhost:52439/caderneta/save

Entrada:

http://pastebin.com/Kc0GNUpL

Retorno:

http://pastebin.com/fsJYytgy 

Observação: caso seja enviado um id da chave primária que já existe no banco, não é cadastrado nada e o método retorna a mesma coisa que veio na requisição.

Caso este ID não exista, é chamado o método de gravação, que grava o registro, caso este não tenha a mesma combinação de chave estrangeira no BD.

Edit

http://localhost:52439/caderneta/edit

Entrada:

http://pastebin.com/wWu3n9ZD

Delete

http://localhost:52439/caderneta/delete?id=1

Aula

GetAll

http://localhost:52439/aula/getall

Retorno:

http://pastebin.com/659YXvgV 

Get

http://localhost:52439/aula/get?id=2005

Retorno:

http://pastebin.com/gwQyh48A 

Save

http://localhost:52439/aula/save

Entrada:

http://pastebin.com/t6x9HQrx saída: http://pastebin.com/sTZ5sX4K

Observação: caso seja enviado um json com um ID que já existe no banco, não é cadastrado nada, e retorna o mesmo json da requisição.

Caso seja enviado um json com um id que não existe, é cadastrada uma nova aula, com um novo ID (que não necessariamente é o ID que veio na requisição), e retornado o novo registro com o novo ID.

Entrada:

http://pastebin.com/WUGHTCy2

Retorno:

http://pastebin.com/yS1RjW8h  

Edit

http://localhost:52439/Aula/Edit

Entrada:

http://pastebin.com/v4vDfyML

Delete

http://localhost:52439/aula/Delete?id=1005 Curso

GetAll

http://localhost:52439/curso/GetAll

Retorno:

http://pastebin.com/14bHspwb 

Get

http://localhost:52439/curso/Get?id=4

Retorno:

http://pastebin.com/5Z6ReW6c 

Save

http://localhost:52439/curso/Save

Entrada:

http://pastebin.com/YgC9Gb8k

Retorno:

http://pastebin.com/DHTfjSmk 

Edit

http://localhost:52439/curso/Edit

Entrada:

http://pastebin.com/shRySuUN

Delete

http://localhost:52439/curso/Delete?id=2

CursoDisciplina

GetAll

http://localhost:52439/cursoDisciplina/GetAll

Retorno:

http://pastebin.com/hdVXZGYz 

Get

http://localhost:52439/cursoDisciplina/Get?id=1011

Retorno:

http://pastebin.com/UAdtQMpJ 

Save

http://localhost:52439/cursoDisciplina/Save

Entrada:

http://pastebin.com/NbvRSgem

Retorno:

http://pastebin.com/ZTka7pqZ 

Delete

http://localhost:52439/cursoDisciplina/Delete?id=1010

Edit

http://localhost:52439/cursoDisciplina/Edit

Entrada:

http://pastebin.com/YRqhvQqh

Disciplina

GetAll

http://localhost:52439/Disciplina/GetAll

Retorno:

http://pastebin.com/zdhQ8ZY2 

Get

http://localhost:52439/Disciplina/Get?id=3

Retorno:

http://pastebin.com/43z0dseW 

Save

http://localhost:52439/Disciplina/Save

Entrada:

http://pastebin.com/s8UqHXwZ

Retorno:

http://pastebin.com/k8dfePdz 

Edit

http://localhost:52439/Disciplina/Edit

Entrada:

http://pastebin.com/qyC2R8KD

Delete

http://localhost:52439/Disciplina/Delete?id=1

DocenteTurmaDisciplina

GetAll

http://localhost:52439/DocenteTurmaDisciplina/getall

Retorno:

http://pastebin.com/rjJJ0cNj 

GetByBusca

Retorna o objeto com os devidos objetos filhos com todos os parâmetros opcionais:

http://localhost:52439/Docenteturmadisciplina/GetByBusca?escolaId=2&cursoId=1&anoId=1&turmaId=1&disciplinaId=2&docenteId=1

Retorno:

http://pastebin.com/R4q9ALXw 

Get

http://localhost:52439/DocenteTurmaDisciplina/get?id=8

Retorno:

http://pastebin.com/HzmBDcQ7 

Save

http://localhost:52439/DocenteTurmaDisciplina/Save

Entrada:

http://pastebin.com/Xc1qUnPx

Retorno:

http://pastebin.com/7PD4x8gT 

Edit

(atenção: é preciso preencher os id’s de turma e disciplina dos objetos internos) http://localhost:52439/DocenteTurmaDisciplina/Edit

Entrada:

http://pastebin.com/ERjUT8iJ

Delete

http://localhost:52439/DocenteTurmaDisciplina/delete?id=6

Turma

GetAll

http://localhost:52439/Turma/GetAll

Retorno:

http://pastebin.com/QGBCs6iA 

GetAllWithEscola

Retorna todas as turmas com os dados da Escola do CoreSSO

http://localhost:52439/Turma/GetAllWithEscola

Retorno:

http://pastebin.com/i3rsn7r2 

Get

http://localhost:52439/Turma/Get?id=2010

Retorno:

http://pastebin.com/0f89jF7N 

GetByEscola

http://localhost:52439/Turma/GetByEscola?id=2 http://pastebin.com/KkkNSTvZ

GetByBusca

http://localhost:52439/Turma/GetByBusca?escolaId=2&anoId=1&cursoId=1

Retorno:

http://pastebin.com/qZmzRzx9 

GetByPessoaEscola

Busca tanto por pes_id do Docente quanto pelo uad_id da Escola (o parâmetro aceita ambos)

http://localhost:52439/Turma/GetByPessoaEscola?pes_id=df97ba73-762e-e611-80c9-00155d000d82

http://localhost:52439/Turma/GetByPessoaEscola?uad_id=67e70485-532e-e611-80c9-00155d000d82


Retorno:

http://pastebin.com/pmpDnaDK 

Save

http://localhost:52439/Turma/Save

Entrada:

http://pastebin.com/8gYEjZuB saída: (em correção)

Edit

http://localhost:52439/Turma/Edit

Entrada:

http://pastebin.com/ScXfYkbY

Delete

http://localhost:52439/Turma/Delete?id=2009

TurmaDisciplina

GetAll

http://localhost:52439/TurmaDisciplina/GetAll

Retorno:

http://pastebin.com/gSz0305h 

GetByBusca

Retorna as turmas + Disciplinas com os id’s de turma e disciplina, ambos opcionais

http://localhost:52439/turmadisciplina/GetByBusca?turmaid=1&disciplinaid=2

Retorno:

http://pastebin.com/8kGNEPC5 

Get

http://localhost:52439/TurmaDisciplina/Get?id=2011

Retorno:

http://pastebin.com/v7JHHdRu 

Save

http://localhost:52439/TurmaDisciplina/Save

Entrada:

http://pastebin.com/dnkeCD5H

Retorno:

http://pastebin.com/SbXYYksH 

Edit

http://localhost:52439/TurmaDisciplina/Edit

Entrada:

http://pastebin.com/fLZmpUEV

Delete

http://localhost:52439/TurmaDisciplina/Delete?id=2010