Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • W wiki
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GasNaPorta
  • wiki
  • Wiki
  • api rotas

Last edited by Felipe Garrastazu Guedes May 16, 2018
Page history
This is an old version of this page. You can view the most recent version or browse the history.

api rotas

ORDER

Historico de pedidos

POST /order/

Adiciona historico dos pedidos

{
	"user" : "5aecc1e68c879d2adf444db6",
	"supplier" : "5ab94945d0032b2d949634d8"
}

GET /order/all?populate=true

?populate=true => facultativo, retorna, apenas sem isso retorna historico dos pedidos `

SUPPLIER

POST /supplier/

Adiciona supplier

{
    name: {type: String, required: true},
    phone: {type: String, required: true},
    address: {type: String, required: true},
    loc: {
        type: {type: String, default: 'Point'},
        coordinates: {type: [Number], default: [0, 0]}
    }
}

Exemplo

{
    "name": "Fornecedor 21", 
    "phone":"123123123",
    "address":"seila",
    "loc": { 
         "coordinates": [ 1 , 11 ]
    }
}

GET /supplier/all?lat=1&long=1&dist=10000

retorna json com todos os fornecedores

POST /supplier/

Adiciona supplier

{
    name: {type: String, required: true},
    phone: {type: String, required: true},
}

USER

POST /user/

Adiciona user

{
    name: {type: String, required: true},
    email: {type: String, required: true, unique: true}, 
    password: {type: String, required: true }
}

POST /user/fav

Adiciona supplier favortos

{
    "supplierId": "5ab94945d0032b2d949634d8"  //objectID
}

DELETE /user/fav

remove supplier favortos

{
"supplierId": "5ab94945d0032b2d949634d8"
}

GET /user/fav

retorna supplier favortos

LOGIN

POST /login/

Efetua login

{
    email: {type: String, required: true }, 
    password: {type: String, required: true }
}

retorna

        return res.json({
            success: true,
            token: token,
            user: user
        });

PADRÕES DE RETORNO

SUCESSO
   -> STATUS 200
   -> NÂO CASO ESPECIFICADO SUCESSO RETORNA {} OBJETO VAZIO

ERROS / INSUCESSOS

   -> STATUS 500 erro interno do servidor
   -> STATUS 404 ROTA NAO ENCONTRADA
Clone repository
  • api rotas
  • api
  • arquitetura
  • design
  • estudo sobre node.js
  • Home
  • kotlin primeiros passos
  • material xml
  • mockups
  • testes sprint 1
  • xml v1