Skip to content

OpenAPI

Examples

Post register

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"}}'
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 -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"}}'
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 -v http://localhost:5000/services \
    -H "Content-Type: application/json"
0N!(`::5000)(`.sd.getServices; ()!());

Post heartbeat

curl -v http://localhost:5000/heartbeat \
    -H "Content-Type: application/json"  \
    --data '{"uid":"ex_svc_12ab","service":"ex_svc","hostname":"host"}'
args:`uid`service`hostname!("ex_svc_12ab"; "ex_svc"; "host")
0N!(`::5000)(`.sd.heartbeat; args)

Post status

curl -v http://localhost:5000/status \
    -H "Content-Type: application/json"  \
    --data '{"uid":"ex_svc_12ab","service":"ex_svc","hostname":"host", "status": "DOWN"}'
args:`uid`service`hostname`status!
  ("ex_svc_12ab"; "ex_svc"; "host"; "DOWN")
0N!(`::5000)(`.sd.updateStatus; args)

Post deregister

curl -v http://localhost:5000/deregister \
    -H "Content-Type: application/json"  \
    --data '{"uid":"ex_svc_12ab","service":"ex_svc","hostname":"host"}'
args:`uid`service`hostname!("ex_svc_12ab"; "ex_svc"; "host")
0N!(`::5000)(`.sd.deregister; args)