This is an example output for GET, POST, PUT and DELETE requests to the Department microservice reachable at gateway in port http://localhost:8222:

Save

POST /api/departments

Path parameters

No parameters.

Query parameters

No parameters.

Request fields

Path Type Optional Description

id

Integer

true

name

String

true

email

String

true

Response fields

Path Type Optional Description

id

Integer

true

name

String

true

email

String

true

Example request

$ curl 'http://localhost:8080/api/departments' -i -X POST \
    -H 'Content-Type: application/json' \
    -d '{"id":1,"name":"Marketing","email":"marketing@mail.com"}'

Example response

HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 72

{
  "id" : 0,
  "name" : "Marketing",
  "email" : "marketing@mail.com"
}

Save

POST /api/departments

Path parameters

No parameters.

Query parameters

No parameters.

Request fields

Path Type Optional Description

id

Integer

true

name

String

true

email

String

true

Response fields

Path Type Optional Description

id

Integer

true

name

String

true

email

String

true

Example request

$ curl 'http://localhost:8080/api/departments' -i -X POST \
    -H 'Content-Type: application/json' \
    -d '{"id":2,"name":"Sales","email":"sales@example.com"}'

Example response

HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 67

{
  "id" : 0,
  "name" : "Sales",
  "email" : "sales@example.com"
}

Find All

GET /api/departments

Path parameters

No parameters.

Query parameters

No parameters.

Request fields

No request body.

Response fields

Path Type Optional Description

[].id

Integer

true

[].name

String

true

[].email

String

true

Example request

$ curl 'http://localhost:8080/api/departments' -i -X GET \
    -H 'Content-Type: application/json'

Example response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 145

[ {
  "id" : 1,
  "name" : "Marketing",
  "email" : "marketing@mail.com"
}, {
  "id" : 2,
  "name" : "Sales",
  "email" : "sales@example.com"
} ]

Update

PUT /api/departments

Path parameters

No parameters.

Query parameters

No parameters.

Request fields

Path Type Optional Description

id

Integer

true

name

String

true

email

String

true

Response fields

Path Type Optional Description

id

Integer

true

name

String

true

email

String

true

Example request

$ curl 'http://localhost:8080/api/departments' -i -X PUT \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -d '{"id":2,"name":"Sales","email":"updatedemail@example.com"}'

Example response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 74

{
  "id" : 2,
  "name" : "Sales",
  "email" : "updatedemail@example.com"
}

Delete

DELETE /api/departments/{departmentId}

Path parameters

Parameter Type Optional Description

departmentId

Integer

false

Query parameters

No parameters.

Request fields

No request body.

Response fields

No response body.

Example request

$ curl 'http://localhost:8080/api/departments/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/departments/{departmentId}

Path parameters

Parameter Type Optional Description

departmentId

Integer

false

Query parameters

No parameters.

Request fields

No request body.

Response fields

No response body.

Example request

$ curl 'http://localhost:8080/api/departments/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.