Network

Enable DHCP

Enables DHCP on a network interface.

Command: PUT
http://localhost/api/v1/host/network/interfaces/<interface>/dhcp
Table 1. Parameter
Field Type Description
interface String Interface name
Curl example
curl --unix-socket /var/run/edge-core/edge-core.sock \
     -X PUT http://localhost/api/v1/host/network/interfaces/enp0s3/dhcp
Table 2. Success 200
Field Type Description
dhcp Boolean Indicates if DHCP is used or not
name String Interface name
type String Interface type
Success response example
{
    "dhcp": true,
    "name": "enp0s3",
    "type": "ethernet"
}
Table 3. Error 4xx
Field Type Description
error_message String A description of the error encountered
status_code Number The status code for the HTTP request
Error response example
{
    "error_message": "Invalid Interface",
    "status_code": 400
}

Get NTP Information

Gets NTP information.

Command: GET
http://localhost/api/v1/host/network/ntp
Curl example
curl --unix-socket /var/run/edge-core/edge-core.sock \
     http://localhost/api/v1/host/network/ntp
Table 4. Success 200
Field Type Description
server String NTP server IP address
Success response example
{
    "servers": [
        "192.168.233.228",
        "ntp.ubuntu.com",
        "time1.google.com"
    ]
}

Get Network Interface

Gets information for a specific network interface.

Command: GET
http://localhost/api/v1/host/network/interfaces/<interface>
Table 5. Parameter
Field Type Description
interface String Name of the interface
Curl example
curl --unix-socket /var/run/edge-core/edge-core.sock \
     http://localhost/api/v1/host/network/interfaces/enp0s3
Table 6. Success 200
Field Type Description
dhcp Boolean Indicates if DHCP is used or not
dns String DNS server IP address
gateway String Gateway IP address
ipv4 String Interface IP address
name String Interface name
type String Interface type
Success response example
{
    "dhcp": true,
    "dns": "10.0.2.3,8.8.8.8",
    "gateway": "10.0.2.2",
    "ipv4": "10.0.2.15/24",
    "name": "enp0s3",
    "type": "ethernet"
}
Table 7. Error 4xx
Field Type Description
error_message String A description of the error encountered
status_code Number The status code for the HTTP request
Error response example
{
    "error_message": "<errorMessage>",
    "status_code": 400
}

Get Network Interfaces

Gets information for the device’s network interfaces.

Command: GET
http://localhost/api/v1/host/network/interfaces
Curl example
curl --unix-socket /var/run/edge-core/edge-core.sock \
     http://localhost/api/v1/host/network/interfaces
Table 8. Success 200
Field Type Description
interfaces Object List of interfaces
dhcp Boolean Indicates if DHCP is used or not
dns String DNS server IP address
gateway String Gateway IP address
ipv4 String Interface IP address
name String Interface name
type String Interface type
Success response example
{
    "interfaces": [
        {
            "dhcp": true,
            "dns": "10.0.2.3,8.8.8.8",
            "gateway": "10.0.2.2",
            "ipv4": "10.0.2.15/24",
            "name": "enp0s3",
            "type": "ethernet"
        }
    ]
}

Get Proxy Information

Gets network proxy information.

Command: GET
http://localhost/api/v1/host/network/proxy
Curl example
curl --unix-socket /var/run/edge-core/edge-core.sock \
     http://localhost/api/v1/host/network/proxy
Table 9. Success 200
Field Type Description
http String HTTP proxy IP address
https String HTTPS proxy IP address
no_proxy String Non-proxy servers
Success response example
{
    "http": "http://3.3.3.3:80",
    "https": "http://5.5.5.5:88",
    "no_proxy": "*.ge.com, *.google.com"
}

Set NTP Information

Sets the NTP server address.

Command: PUT
http://localhost/api/v1/host/network/ntp
Table 10. Parameter
Field Type Description
server String IP address of an NTP server
Curl example
curl http://localhost/api/v1/host/network/ntp \
    --unix-socket /var/run/edge-core/edge-core.sock \
    -X PUT \
    -H "Content-Type: application/json" \
    -d '{
          "servers" : ["192.168.233.228", "ntp.ubuntu.com", "time1.google.com"]
        }'
Table 11. Success 200
Field Type Description
server String IP address of an NTP server
Success response example
{
    "servers": [
        "192.168.233.228",
        "ntp.ubuntu.com",
        "time1.google.com"
    ]
}
Table 12. Error 4xx
Field Type Description
error_message String A description of the error encountered
status_code Number The status code for the HTTP request
Error response example
{
    "error_message": "<errorMessage>",
    "status_code": 400
}

Set Network Interface

Manually configures a network interface.

Command: PUT
http://localhost/api/v1/host/network/interfaces/<interface>/manual
Table 13. Parameters
Field Type Description
ipv4 String Network interface IP address
gateway String Gateway IP address
dns String DNS server IP address
Curl example
curl http://localhost/api/v1/host/network/interfaces/enp0s3/manual \
    --unix-socket /var/run/edge-core/edge-core.sock \
    -X PUT \
    -H "Content-Type: application/json" \
    -d '{
            "ipv4": "192.168.233.228/24",
            "gateway": "192.168.233.2",
            "dns": "192.168.233.2"
        }'
Table 14. Success 200
Field Type Description
dhcp Boolean Indicates if DHCP is used or not
dns String DNS server IP address
gateway String Gateway server IP address
ipv4 String IP network interface address
name String Network interface name
type String Network interface type
Table 15. Error 4xx
Field Type Description
error_message String A description of the error encountered
status_code Number The status code for the HTTP request
Error response example
{
    "error_message": "<errorMessage>",
    "status_code": 400
}

Set Proxy Information

Sets network proxy information. A reboot is required for the new proxy setting(s) to take effect. All running Edge applications will be redeployed automatically during the next reboot to pickup the new proxy values.

Command: PUT
http://localhost/api/v1/host/network/proxy
Table 16. Parameters
Field Type Description
http String HTTP proxy IP address
https String HTTPS proxy IP address
no_proxy String Non-proxy servers
Curl example
curl http://localhost/api/v1/host/network/proxy \
    --unix-socket /var/run/edge-core/edge-core.sock \
    -X PUT \
    -H "Content-Type: application/json" \
    -d '{
            "http" : "http://192.168.223.228:80",
            "https" : "http://192.168.233.229:80",
            "no_proxy": "google.com"
        }'
Table 17. Success 200
Field Type Description
proxy String "Proxy set successfully"
Success response example
{
    "proxy": "Proxy set successfully"
}
Table 18. Error 4xx
Field Type Description
error_message String A description of the error encountered
status_code Number The status code for the HTTP request
Error response example
{
    "error_message": "<errorMessage>",
    "status_code": 400
}