Skip to content

REST Samples

CaiShu edited this page Apr 14, 2024 · 2 revisions
  • Connect to a mesh:
admin@ip-172-31-30-155:~$ curl -i http://localhost:6666/api/meshes/my-mesh --data-raw '{"agent":{"name":"my-mesh","certificate":"aaa","privateKey":"sss"},"bootstraps":["127.0.0.1:8443"]}'
HTTP/1.1 201 Created
content-type: application/json
content-length: 174
connection: keep-alive

{"name":"my-mesh","agent":{"name":"my-mesh","certificate":"aaa","privateKey":"sss","id":"4f1825b9-0633-4baf-b503-1b31cfc3f53a"},"bootstraps":["127.0.0.1:8443"],"status":"OK"}
  • create a service on an agent :
admin@ip-172-31-30-155:~$ curl -i http://localhost:6666/api/meshes/sweden/endpoints/22a823ce-f155-4030-8fae-364111c70a13/services/tcp/mysvc --data-raw '{"port":8080,"host":"127.0.0.1"}'
HTTP/1.1 201 Created
content-type: application/json
content-length: 187
connection: keep-alive

{"name":"mysvc","protocol":"tcp","endpoints":[{"id":"22a823ce-f155-4030-8fae-364111c70a13","name":"aws","isLocal":true}],"isDiscovered":true,"isLocal":true,"host":"127.0.0.1","port":8080}