Skip to content

Service Discovery

The KXI Discovery Service REST OpenAPI documentation is available below

Post register

curl sample

curl -v http://localhost:5000/register \
    -H "Content-Type: application/json"  \
    --data '{"uid":"ex_svc_12ab","service":"ex_svc","hostname":"host","port":"5050", "ip":"0.0.0.0", "status": "UP","metadata":{"connectivity":"tcp"}}'

q IPC example

args:`uid`service`hostname`port`ip`status`metadata!("ex_svc_12ab"; "ex_svc"; "host"; 5050; "0.0.0.0"; "UP"; enlist[`connectivity]!enlist `tcp);
0N!(`::5000)(`.sd.register; args);

Post update

curl sample

curl -v http://localhost:5000/update \
  -H "Content-Type: application/json"  \
  --data '{"uid":"ex_svc_12ab","service":"ex_svc","hostname":"localhost","port":"5050", "ip":"0.0.0.0", "status": "UP","metadata":{"connectivity":"tcp","data":"quotes"}}'

q IPC example

args:`uid`service`hostname`port`ip`status`metadata!("ex_svc_12ab"; "ex_svc"; "host"; 5050; "0.0.0.0"; "UP"; `connectivity`data!`tcp`quotes);
0N!(`::5000)(`.sd.updateDetails; args);

Get services

curl sample

curl -v http://localhost:5000/services \
    -H "Content-Type: application/json"

q IPC example

0N!(`::5000)(`.sd.getServices; ()!());

Post heartbeat

curl sample

curl -v http://localhost:5000/heartbeat \
    -H "Content-Type: application/json"  \
    --data '{"uid":"ex_svc_12ab","service":"ex_svc","hostname":"host"}'

q IPC example

args:`uid`service`hostname!("ex_svc_12ab"; "ex_svc"; "host");
0N!(`::5000)(`.sd.heartbeat; args);

Post status

curl sample

curl -v http://localhost:5000/status \
    -H "Content-Type: application/json"  \
    --data '{"uid":"ex_svc_12ab","service":"ex_svc","hostname":"host", "status": "DOWN"}'

q IPC example

args:`uid`service`hostname`status!("ex_svc_12ab"; "ex_svc"; "host"; "DOWN");
0N!(`::5000)(`.sd.updateStatus; args);

Post deregister

curl sample

curl -v http://localhost:5000/deregister \
    -H "Content-Type: application/json"  \
    --data '{"uid":"ex_svc_12ab","service":"ex_svc","hostname":"host"}'

q IPC example

args:`uid`service`hostname!("ex_svc_12ab"; "ex_svc"; "host");
0N!(`::5000)(`.sd.deregister; args);