APIs

API: Mobile device -> Push platform

The mobile device SHALL inform his own Push platform each time some network data is changed. (network change, IP change, ...).

The data sent to the Push platform SHALL contain:

  • Mobile IP address
  • TCP or UDP port in which the mobile agent is listening
  • MCC-MNC or Network ID ("Network identification")

API: Push platform -> WakeUp platform (Global node)

This service exposes a REST API in which some resources are shared with other platform services (please refer to "Common REST API resources")

These servers listens in HTTP and not in HTTPS since SSL SHALL be terminated by software (nginx, for example) or hardware equipments

This means, that all HTTP queries to the WakeUp nodes shall contain these extra headers to inform about the client certificate. If these headers are not provided, WakeUp servers will answer with an error (Status code 400).

  • X-Real-IP:

    This header will contain the IP address of the client.

    This will be used in log traces.

  • X-Forwarded-For:

    This headers contains the different proxies IP addresses used between the client and the server.

  • X-Client-Cert-DN:

    This will contain the client certificate DN string used to identify the client in all log traces.

    This will be used in log traces.

  • X-Client-Cert-Verified:

    If SSL client verification is valid and SSL terminator rely on this. This header SHALL contain 'SUCCESS'.

    Any other value will be considered an invalid certificate and the connection will be rejected.

REST API: wakeup (global) resource

Resource path is: wakeup/v1

This resource is used to wake up a device. Only POST method is allowed.

POST

The HTTP payload is a parametrized string in "querystring" format:

              param1=value1&param2=value2&param3=value3
            

  • ip:

    IP Address of the client device

    Shall be a valid IPv4 address

  • port:

    TCP or UDP port in which the client is waiting wakeup for notifications

    Shall be a number between 1 and 65535

  • netid:

    Network ID ("Network identification")

    Shall be a string

  • mcc:

    Mobile Country Code (if netid is not provided)

    Shall be a number

  • mnc:

    Mobile Network Code (if netid is not provided)

    Shall be a number

  • proto:

    WakeUp protocol.

    This is optional. By default UDP

    Shall be one of these values:

    • tcp
    • udp

Multiple checks will be done before the client receives the final response.

These errors will inform about different issues:

  • Mandatory parameters:

    If the mandatory parameters are not present a status code 400 will be responded.

    Mandatory parameters are: ip and port numbers and netid or MCC/MNC pair.

  • Mobile device identification (IP and Port)

    Also the IP parameter will be validated as a valid IPv4 address. The Port shall be between 1 and 65535.

  • Mobile network identification

    If the MCC/MNC pair or NetID suplied is not managed by the server (local node not found) a status code 404 (not found) is responded.

  • Device in the network

    If the device IP is not inside the mobile network ranges, a status code 400 will be responded (No valid device IP)

  • Mobile network status

    If the mobile network local server status is offline for any cause, a status code 503 is returned and should be retried later.

  • Protocol accepted

    If the network configuration informs about the optional supported protocols parameter, the protocol queried by the client (proto parameter) will be validated and if the protocol is not accepted by the local node a status code 400 will be sent to the client.

In any other case a 200 OK status code will be responded. This means that the platform will try to deliver the message to the local node, anyway if any error is produced during this process the client won't be informed so it should retry again if the device is not waked up.

REST API: netinfo resource

Resource path is: netinfo/v1

This method informs about all supported networks by this server and the current status of each one.

GET

Only GET method is allowed. The response contains an array with all supported networks with the mcc-mnc of each one, the assigned network id (netid), the IP accepted range or ranges and the current status of the network (offline)

A list of supported protocols can be (it's optional) listed into the protocols array.

               {"nets": [{"netid":"214-07","mccmnc":"214-07","range":"10.0.0.0/8","protocols": ["tcp","udp"],"offline":true}]}
            

Internal API: Local nodes

REST API: wakeup (local) resource

Resource path is: wakeup

This resource is used to wake up a device. POST and GET are supported. GET is supported for backwards compatibility but it's deprecated.

POST

The HTTP payload is a parametrized string in "querystring" format:

              param1=value1&param2=value2&param3=value3
            

GET

The URL contains a parametrized string in "querystring" format:

              param1=value1&param2=value2&param3=value3
            

Common querystring for GET and POST methods

  • ip:

    IP Address of the client device

    Shall be a valid IPv4 address

  • port:

    TCP or UDP port in which the client is waiting wakeup for notifications

    Shall be a number between 1 and 65535

  • proto:

    WakeUp protocol.

    This is optional. By default UDP

    Shall be one of these values:

    • tcp
    • udp

Common REST API resources

REST API: about resource

Resource path is: about

Also, this is the default path, if no other path is defined.

GET

No parameters needed. Returns a HTML information page

REST API: status resource

Resource path is: status

This method is used to check server availability. If, for any reason, it's needed to avoid traffic through one server, this method can set the service as offline.

Can be used by load balancers and by the global checker service

GET

No parameters needed. Returns a 200 OK or 503 Service Unavailable.

POST

Changes the status of the service.

The HTTP payload is a parametrized string in "querystring" format:

              param1=value1&param2=value2&param3=value3
            

with only one value:

enable = [true | false]

To enable or disable, you can use this simple curl calls:

curl -d 'enable=true' -k --key test_ca/TEST_CERTIFICATES/client.key --cert test_ca/TEST_CERTIFICATES/client.crt https://localhost/local/status

curl -d 'enable=false' -k --key test_ca/TEST_CERTIFICATES/client.key --cert test_ca/TEST_CERTIFICATES/client.crt https://localhost/local/status