Host Database API

Read all hosts


http://localhost:8080/api/v1/
http://localhost:8080/api/v1/?a=readAll

Example

http://localhost:8080/api/v1/?a=readAll

[
  {
    "id": "1",
    "name": "www.google.com",
    "address": "216.58.222.100"
  }
]

Read host by id


http://localhost:8080/api/v1/?a=read&id=:id

Params

Name Type Description
:id Integer host id

Example

http://localhost:8080/api/v1/?a=read&id=1

{
  "id": "1",
  "name": "www.google.com",
  "address": "216.58.222.100"
}

Create host


http://localhost:8080/api/v1/?a=create&name=:name&address=:address

Params

Name Type Description
:name String hostname
:address String IP Address

Example

http://localhost:8080/api/v1/?a=create&name=www.ifpb.edu.br&address=200.129.77.61

{
  "status": "host created."
}

Update host


http://localhost:8080/api/v1/?a=update&id=:id&name=:name&address=:address

Params

Name Type Description
:id Integer host id
:name String hostname
:address String IP Address

Example

http://localhost:8080/api/v1/?a=update&id=2&name=www.ifpb.edu.br&address=200.129.77.62

{
  "status": "host updated."
}

Remove host


http://localhost:8080/api/v1/?a=remove&id=:id

Params

Name Type Description
:id Integer host id

Example

http://localhost:8080/api/v1/?a=remove&id=2

{
  "status": "host removed."
}