UDMG Agent Proxy Web Services
Introduction
The Agent Proxy client is exposing a REST API for the maintenance of the forwarding services. The port is configured with the '[client.api] port
' parameter.
Below are the available endpoints and examples of requests and responses.
Authentication
Only one set of credentials is supported for the REST API. It is configured under the [client.api]
section with the user and password parameters
[client.api] # UDMG Agent Client Admin API port="2280" # API basic authentication credentials, no default username = "api_user" password = "api_password"
The authentication of REST requests is done using basic HTTP authentication.
This authentication scheme is done using the HTTP Authorization header. To authenticate, the client must:
Step 1 | Obtain user login and password. |
---|---|
Step 2 | Build the user ID by concatenating the login, a colon (“:”) character ,and the password. |
Step 3 | Encode the obtained identifier in Base64. |
Step 4 | Prefix the encoded identifier with a declaration of the basic authentication scheme (“Basic”). |
For example, if the user enters the name "Aladdin" and the password "open sesame", then the client must send the following header:
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
If the authentication of a request fails, the server will respond with an HTTP code .401 - Unauthorized
Agent Administration
Agent Proxy Status
GET /api/status/
- Retrieves the status of the client.
Response: { "agent": { "status":"agent_status", "agent_address":"agent_address" }, "forwards": [ { "name":"service_name", "local_port":"service_local_port", "service_address":"service_address", "status":"service_status", "last_message":"last_message" }, { "name":"service_name", "local_port":"service_local_port", "service_address":"service_address", "status":"service_status", "last_message":"last_message" } ] }
Save Configuration
POST /api/config/save?name=name
- Saves the current configuration.
The name
parameter is optional, and the current config path will be used if it is not provided.
Agent Service Configuration
Proxy Services Status
GET /api/services/
- Retrieves the status of the services.
Response: { "forwards": { "service_name1": { "name":"service_name1", "local_port":"service_local_port", "service_address":"service_address", "status":"service_status", "last_message":"last_message" }, "service_name2": { "name":"service_name2", "local_port":"service_local_port", "service_address":"service_address", "status":"service_status", "last_message":"last_message" } } }
SingleProxy Service Status
GET /api/services/:name
- Retrieves the status of a particular service.
Response: { "name":"service_name", "local_port":"service_local_port", "service_address":"service_address", "status":"service_status", "last_message":"last_message" }
New Proxy Service
POST /api/services
- Creates a new service.
Request: { "name": "service_name", "port": "service_port", "host": "service_host" }
Fields port
and host
are optional, and the parameters will be obtained from the UDMG Server if they are not provided.
Agent Service Operation
Start Proxy Service
PUT /api/services/:name/start
- Starts a service.
Stop Proxy Service
PUT /api/services/:name/stop
- Stops a service.