scope icon indicating copy to clipboard operation
scope copied to clipboard

How can i use id to get one container by /api/topology/containers

Open dengceltics opened this issue 7 years ago • 1 comments

"bd4b3532edb18f16076e279913f2451d2373226e985647b731d3126cc99137ff;":{ "id":"bd4b3532edb18f16076e279913f2451d2373226e985647b731d3126cc99137ff;", "label":"POD", "labelMinor":"node-rwc3apul", "rank":"google_containers/pause-amd64", "shape":"hexagon", "metadata":[ { "id":"docker_image_tag", "label":"Image tag", "value":"3.1", "priority":1 }, { "id":"docker_image_name", "label":"Image name", "value":"gcr.io/google_containers/pause-amd64", "priority":2 }, { "id":"docker_container_command", "label":"Command", "value":"/pause ", "priority":3 }, { "id":"docker_container_state_human", "label":"State", "value":"Up 11 days", "priority":4 }, { "id":"docker_container_uptime", "label":"Uptime", "value":"1004593", "priority":5, "dataType":"duration" }, { "id":"docker_container_restart_count", "label":"Restart #", "value":"0", "priority":6 }, { "id":"docker_container_ips", "label":"IPs", "value":"10.233.118.136", "priority":8 }, { "id":"docker_container_created", "label":"Created", "value":"2019-02-21T11:54:57.430750742Z", "priority":10, "dataType":"datetime" }, { "id":"docker_container_id", "label":"ID", "value":"bd4b3532edb18f16076e279913f2451d2373226e985647b731d3126cc99137ff", "priority":11, "truncate":12 } ],

Can i use API to get this json by container_id , The initial JSON string is too long.

dengceltics avatar Mar 05 '19 04:03 dengceltics

Scope FAQ doc has a small section summarizing the API endpoints. The last bullet point there is for the endpoint that you're probably interested in: /api/topology/[TOPOLOGY]/[NODE_ID]

So in particular for the JSON you pasted above, you'd want to GET /api/topology/containers/bd4b3532edb18f16076e279913f2451d2373226e985647b731d3126cc99137ff;.

Unfortunately, as the section explains, having to get the internal node ID in the first place in order to make use of this is not always ideal, but is the only option until #3122 is addressed.

Does that answer your question @dengceltics?

fbarl avatar Mar 06 '19 11:03 fbarl