Skip to content

ErnestoSalazar/Integrador

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Integrador

Web service, Web, Desktop and mobile clients for a school project

Web service

Endpoints HTTP verbs Examples
/login POST form: grant_type: password, username: correo, password: myPassword
/login/recover POST {mailTo: correo}
/api/users POST/GET {nombre, apellido, correo, rfc, rol}
/api/users? GET rol=rol or nombre=nombre&apellido=apellido
/api/users/{id} GET/PUT/DELETE {nombre, apellido, correo, rfc, rol, password}
/api/barcos POST/GET {nombre, descripcion, usuarioId}
/api/barcos? GET nombre=nombre
/api/barcos/{id} GET/PUT/DELETE {nombre, descripcion, usuarioId}
/api/cargas POST/GET {cantidad, especie, talla, temperatura, condicion, barcoId}
/api/cargas/{id} GET/PUT/DELETE {cantidad, especie, talla, temperatura, condicion, barcoId}
/api/entradas POST/GET {usuarioId, cargasId:[]}
/api/entradas? GET fechaInicio=yyyy/mm/dd&fechaFin=yyyy/mm/dd or folio=folio
/api/entradas/{id} GET/PUT/DELETE {cargasId:[]}

Login

after Login you will recieve a response like this :

{
    "access_token": "3Ze_IidQ6V4W6r6tU573qLtdUQNL58mKduW6umivfypfImTPg-HxrgvqvFGGRhyfg5hP0JV-L2D3Y9Sh7iGjMex-ROBHMC0XoL_9IBjtQqt1SDyW9B31Xn_LEITH-V7ddHVcfSMhcNCp_sk4-HGBL82zf_AaHJpNzOlCKAJZ77p0V4AZZ1YT7foMn5hnLWiXKWWYYWz-3Y66xuFLNnvARa1zSKy0zHXtwT089JkooI3cbJqf5n2SLFd9Y6StMg7r0cPI3QvFt3tkawqGz2DMsKSB_HW2najo88ahPHH6GX74fpTxwixGBMiqZpOSHqqMYqbuXC_7rs5GcZVcMzi2THpM6UYWCYjKfHsmb1VtxL-n0UeokvqjUFIYcJQ-v3fLZdPsB8dyLzDWnnOnQjRedA",
    "token_type": "bearer",
    "expires_in": 86399,
    "userName": "correo@example.com",
    "rol": "Admin",
    "userId": "1",
    "nombre": "Ernesto",
    "apellido": "Salazar",
    ".issued": "Fri, 24 Nov 2017 22:24:27 GMT",
    ".expires": "Sat, 25 Nov 2017 22:24:27 GMT"
}

in case of a failed login you will receive a status code of 400 and a json with error description otherwise you will need to keep the access_token, this one needs to be sended on the header of every request made to /api/* with the key/value:

Authorization : bearer access_token

Status

Ok

  • When creating any new entity you will get a status code of 201 and a json response with inserted data

  • When retrieving any entity you will get a status code of 200 and json response or an array of jsons if retrieving a list of entities

  • When updating any entity you will get a status code of 204

  • When deleting any entity you will get a status code of 204

Error

  • When retrieving any entity or list of entities that does not exist you will get a status of 404
  • When login fail you will get a status code of 400 and a json response with error description

Users

detalles When creating a new user, a password will be created automatically by the server and will be send via email

When retrieving a single usuario you will recieve the following data

    {
        "id": 1,
        "nombre": "Ernesto",
        "apellido": "Salazar",
        "rfc": "sdsdfsd",
        "correo": "correo@example.com",
        "rol": "Admin"
    }

When retrieving multiple usuarios you will recieve the following data

[
    {
        "id": 1,
        "nombre": "Ernesto",
        "apellido": "Salazar",
        "rfc": "sdsdfsd",
        "correo": "correo@example.com",
        "rol": "Admin"
    }
]

When making a GET call to /api/users?nombre=example&apellido=example you will recieve the following data that matches the user nombre and apellido

[
    {
        "id": 32,
        "nombre": "Ernesto",
        "apellido": "Salazar",
        "rfc": "sdsdfsd",
        "correo": "ernestoalbertosalazar@gmail.com",
        "rol": "Admin"
    }
]

When making a GET call to /api/users?rol=example you will recieve the following data that matches the user role

[
    {
        "id": 35,
        "nombre": "Isael",
        "apellido": "Atondo",
        "rfc": "isael",
        "correo": "isaelatondo@gmail.com",
        "rol": "Pescador"
    }
]

Accepted values for the following properties are:

  • Rol: Administrador, Supervisor, Pescador

Barcos

Detalles

When retrieving a single barco you will recieve the following data

    {
        "id": 1,
        "nombre": "barco 1",
        "descripcion": "BARCO_CAMARONERO",
        "usuarioId": 1,
        "usuario": {
            "id": 1,
            "nombre": "Ernesto",
            "apellido": "Salazar",
            "rfc": "sdsdfsd",
            "correo": "correo@example.com",
            "rol": "Admin",
        }
    }

When retrieving multiple barcos you will recieve the following data

[
    {
        "id": 1,
        "nombre": "barco 1",
        "descripcion": "BARCO_CAMARONERO",
        "usuarioId": 1,
        "usuario": {
            "id": 1,
            "nombre": "Ernesto",
            "apellido": "Salazar",
            "rfc": "sdsdfsd",
            "correo": "correo@example.com",
            "rol": "Admin"
        }
    }
]

Cargas

detalles

When retrieving a single carga you will recieve the following data

    {
        "id": 1,
        "cantidad": 150,
        "especie": "Japonesa",
        "talla": "m",
        "temperatura": 99.5,
        "condicion": "Regular",
        "barcoId": 1,
        "barco": {
            "id": 1,
            "nombre": "barco 1",
            "descripcion": "BARCO_CAMARONERO",
            "usuarioId": 1,
            "usuario": null
        },
        "entradaId": 1
    }

When retrieving multiple cargas you will recieve the following data

[
    {
        "id": 1,
        "cantidad": 150,
        "especie": "Japonesa",
        "talla": "m",
        "temperatura": 99.5,
        "condicion": "Regular",
        "barcoId": 1,
        "barco": {
            "id": 1,
            "nombre": "barco 1",
            "descripcion": "BARCO_CAMARONERO",
            "usuarioId": 1,
            "usuario": {
                "id": 1,
                "nombre": "Ernesto",
                "apellido": "Salazar",
                "rfc": "sdsdfsd",
                "correo": "correo@example.com",
                "rol": "Admin"
            }
        },
        "entradaId": 1
    }
]

Accepted values for the following properties are:

  • Especie: Macarela, Japonesa, Monterrey, Rayadillo, Bocona, Anchoveta, Crinuda
  • Talla: S, M, L, XL
  • Condicion: Mala, Regular, Buena

Entradas

Detalles

When retrieving a single entrada you will recieve the following data

    {
    "id": 1,
    "folio": "20171124_153209",
    "fecha": "2017-11-24T00:00:00",
    "hora": "15:32:00",
    "turno": "Vespertino",
    "usuarioId": 1,
    "usuario": {
        "id": 1,
        "nombre": "Ernesto",
        "apellido": "Salazar",
        "rfc": "sdsdfsd",
        "correo": "correo@example.com",
        "rol": "Admin"
    },
    "cargas": [
        {
            "id": 1,
            "cantidad": 150,
            "especie": "Japonesa",
            "talla": "m",
            "temperatura": 99.5,
            "condicion": "Regular",
            "barcoId": 1,
            "barco": null,
            "entradaId": 1
        }
    ],
    "totalMacarela": 0,
    "totalJaponesa": 150,
    "totalMonterrey": 0,
    "totalRayadillo": 0,
    "totalBocona": 0,
    "totalAnchoveta": 0,
    "totalCrinuda": 0,
    "porcentajeMacarela": 0,
    "porcentajeJaponesa": 100,
    "porcentajeMonterrey": 0,
    "porcentajeRayadillo": 0,
    "porcentajeBocona": 0,
    "porcentajeAnchoveta": 0,
    "porcentajeCrinuda": 0,
    "totales": 150
}

When retrieving multiple entradas you will recieve the following data

[
    {
        "id": 1,
        "folio": "20171124_153209",
        "fecha": "2017-11-24T00:00:00",
        "hora": "15:32:00",
        "turno": "Vespertino",
        "usuarioId": 1,
        "usuario": {
            "id": 1,
            "nombre": "Ernesto",
            "apellido": "Salazar",
            "rfc": "sdsdfsd",
            "correo": "correo@example.com",
            "rol": "Admin"
        },
        "cargas": [
            {
                "id": 1,
                "cantidad": 150,
                "especie": "Japonesa",
                "talla": "m",
                "temperatura": 99.5,
                "condicion": "Regular",
                "barcoId": 1,
                "barco": null,
                "entradaId": 1
            }
        ]
        
    }
]

Accepted values for the following properties are:

  • Turno: Matutino, Vespertino

Entradas by date

Detalles When searching an entrada by a date you will receive a json array with the following data that matches with those dates parameters
[
    {
        "id": 1,
        "folio": "20171124_153209",
        "fecha": "2017-11-24T00:00:00",
        "hora": "15:32:00",
        "turno": "Vespertino",
        "usuarioId": 1,
        "usuario": {
            "id": 1,
            "nombre": "Ernesto",
            "apellido": "Salazar",
            "rfc": "sdsdfsd",
            "correo": "correo@example.com",
            "rol": "Admin"
        },
        "cargas": [
            {
                "id": 1,
                "cantidad": 150,
                "especie": "Japonesa",
                "talla": "m",
                "temperatura": 99.5,
                "condicion": "Regular",
                "barcoId": 1,
                "barco": null,
                "entradaId": 1
            }
        ]
    }
]

About

School project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published