This is an example output for POST, GET, PUT and DELETE requests to the Employee microservice reachable at gateway in port http://localhost:8222:
Save
POST /api/employees
Path parameters
No parameters.
Query parameters
No parameters.
Request fields
| Path | Type | Optional | Description |
|---|---|---|---|
id |
Integer |
true |
|
firstName |
String |
true |
|
lastName |
String |
true |
|
String |
true |
||
departmentId |
Integer |
true |
Response fields
| Path | Type | Optional | Description |
|---|---|---|---|
id |
Integer |
true |
|
firstName |
String |
true |
|
lastName |
String |
true |
|
String |
true |
||
departmentId |
Integer |
true |
Example request
$ curl 'http://localhost:8080/api/employees' -i -X POST \
-H 'Content-Type: application/json' \
-d '{"id":1,"firstName":"Penelope","lastName":"Hartmann","email":"Andreane17@yahoo.com","departmentId":1}'
Example response
HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 127
{
"id" : 0,
"firstName" : "Penelope",
"lastName" : "Hartmann",
"email" : "Andreane17@yahoo.com",
"departmentId" : 1
}
Save
POST /api/employees
Path parameters
No parameters.
Query parameters
No parameters.
Request fields
| Path | Type | Optional | Description |
|---|---|---|---|
id |
Integer |
true |
|
firstName |
String |
true |
|
lastName |
String |
true |
|
String |
true |
||
departmentId |
Integer |
true |
Response fields
| Path | Type | Optional | Description |
|---|---|---|---|
id |
Integer |
true |
|
firstName |
String |
true |
|
lastName |
String |
true |
|
String |
true |
||
departmentId |
Integer |
true |
Example request
$ curl 'http://localhost:8080/api/employees' -i -X POST \
-H 'Content-Type: application/json' \
-d '{"id":2,"firstName":"Emilio","lastName":"Rodriguez","email":"emilio@example.com","departmentId":2}'
Example response
HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 124
{
"id" : 0,
"firstName" : "Emilio",
"lastName" : "Rodriguez",
"email" : "emilio@example.com",
"departmentId" : 2
}
Find All
GET /api/employees
Path parameters
No parameters.
Query parameters
No parameters.
Request fields
No request body.
Response fields
| Path | Type | Optional | Description |
|---|---|---|---|
[].id |
Integer |
true |
|
[].firstName |
String |
true |
|
[].lastName |
String |
true |
|
String |
true |
||
[].departmentId |
Integer |
true |
Example request
$ curl 'http://localhost:8080/api/employees' -i -X GET \
-H 'Content-Type: application/json'
Example response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 257
[ {
"id" : 1,
"firstName" : "Penelope",
"lastName" : "Hartmann",
"email" : "Andreane17@yahoo.com",
"departmentId" : 1
}, {
"id" : 2,
"firstName" : "Emilio",
"lastName" : "Rodriguez",
"email" : "emilio@example.com",
"departmentId" : 2
} ]
Update
PUT /api/employees
Path parameters
No parameters.
Query parameters
No parameters.
Request fields
| Path | Type | Optional | Description |
|---|---|---|---|
id |
Integer |
true |
|
firstName |
String |
true |
|
lastName |
String |
true |
|
String |
true |
||
departmentId |
Integer |
true |
Response fields
| Path | Type | Optional | Description |
|---|---|---|---|
id |
Integer |
true |
|
firstName |
String |
true |
|
lastName |
String |
true |
|
String |
true |
||
departmentId |
Integer |
true |
Example request
$ curl 'http://localhost:8080/api/employees' -i -X PUT \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"id":2,"firstName":"Emilio","lastName":"Gonzalez","email":"emilio@example.com","departmentId":2}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 123
{
"id" : 2,
"firstName" : "Emilio",
"lastName" : "Gonzalez",
"email" : "emilio@example.com",
"departmentId" : 2
}
Delete
DELETE /api/employees/{employeeId}
Path parameters
| Parameter | Type | Optional | Description |
|---|---|---|---|
employeeId |
Integer |
false |
Query parameters
No parameters.
Request fields
No request body.
Response fields
No response body.
Example request
$ curl 'http://localhost:8080/api/employees/1' -i -X DELETE \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
Example response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1
1
Delete
DELETE /api/employees/{employeeId}
Path parameters
| Parameter | Type | Optional | Description |
|---|---|---|---|
employeeId |
Integer |
false |
Query parameters
No parameters.
Request fields
No request body.
Response fields
No response body.
Example request
$ curl 'http://localhost:8080/api/employees/2' -i -X DELETE \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
Example response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1
2
You always get the same message.