Documentacion de los metodos expuesto por la Api
(IDE: Eclipse - Import as Existing Maven Projects)
- POST /login
- GET /items
- POST /entrada
- POST /salida
- GET /stocks
- GET /stocks/{itemCodigo}
Username | Password | Rol |
---|---|---|
|
|
EMPLEADO |
|
|
CLIENTE |
Devuleve token de seguridad para consumir los demas endpoints
Path | Type | Description |
---|---|---|
|
|
Username |
|
|
Password |
Path | Type | Description |
---|---|---|
|
|
Siempre 200 |
|
|
Token de seguridad para consumir los demas metodos, expira dentre de 60 minutos |
$ curl 'http://localhost:8080/login' -i -X POST \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Accept: application/json' \
-d '{"username":"empleado","password":"123456"}'
GET /items HTTP/1.1
Authorization: Bearer Token...
Host: localhost:8080
HTTP/1.1 200 OK X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block Cache-Control: no-cache, no-store, max-age=0, must-revalidate Pragma: no-cache Expires: 0 X-Frame-Options: DENY Content-Length: 209
{"status":200,"token":"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJlbXBsZWFkbyIsInJvbCI6IlJPTEVfRU1QTEVBRE8iLCJleHAiOjE2MzA5ODEwMTV9.cQeVkRNSAPRR85nRthHGy2oTg96CubOIUFW-mvHEk0LquN8-H0i3Q-HSHfjsIOd51ccyZ0hWnYcA3YNz6ph07w"}
Registra ingreso de articulos al stock (solo puede ser ejecutado por usuario con rol EMPLEADO)
$ curl 'http://localhost:8080/entrada' -i -X POST \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer Token...' \
-d '{"itemCodigo": "CAM_0001","valorUnitario": 134 ,"cantidad": 18}'
Registra salida de articulos del stock (solo puede ser ejecutado por usuario con rol CLIENTE)
$ curl 'http://localhost:8080/salida' -i -X POST \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer Token...' \
-d '{"itemCodigo": "CAM_0001","valorUnitario": 134 ,"cantidad": 18}'
Devuelve todos los Articulos
Accesible para Roles: EMPLEADO CLIENTE
Path | Type | Description |
---|---|---|
|
|
El identificador unico del articulo |
|
|
El codigo del articulo (es unico) |
|
|
Tipo de articulo |
|
|
Descripcion del articulo |
$ curl 'http://localhost:8080/items' -i -X GET \
-H 'Authorization: Bearer Token...'
GET /items HTTP/1.1
Authorization: Bearer Token...
Host: localhost:8080
HTTP/1.1 200 OK Content-Type: application/json X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block Cache-Control: no-cache, no-store, max-age=0, must-revalidate Pragma: no-cache Expires: 0 X-Frame-Options: DENY Content-Length: 162
[{"id":1,"codigo":"CAM_0001","tipo":"Camiseta","descripcion":"Camiseta Marvel"},{"id":2,"codigo":"CAM_0002","tipo":"Camiseta","descripcion":"Camiseta DC comics"}]