|
| 1 | +# API Migration Examples |
| 2 | + |
| 3 | +## Some dos and don'ts |
| 4 | + |
| 5 | +### Don't URLEncode the prefix - it won't work |
| 6 | +curl -s -X PUT -d '{"postgres_exporter":{"enable":false}}' "http://admin:admin@127.0.0.1:8080/v1/inventory/agents/%2Fagent_id%2Ff56ee4e8-116c-496b-812f-a803dd2fe88d" |
| 7 | + |
| 8 | +### Don't use plain bold prefix - it won't work |
| 9 | +curl -s -X PUT -d '{"postgres_exporter":{"enable":false}}' "http://admin:admin@127.0.0.1:8080/v1/inventory/agents//agent_id/f56ee4e8-116c-496b-812f-a803dd2fe88d" |
| 10 | + |
| 11 | +### Do pass UUID as an URL path segment |
| 12 | +curl -s -X PUT -d '{"postgres_exporter":{"enable":false}}' http://admin:admin@127.0.0.1:8080/v1/inventory/agents/f56ee4e8-116c-496b-812f-a803dd2fe88d |
| 13 | + |
| 14 | +## Examples |
| 15 | + |
| 16 | +### POST /v1/inventory/Agents/Change -> PUT /v1/inventory/agents/{agent_id} |
| 17 | +curl -s -X PUT -d '{"postgres_exporter":{"enable":true}}' http://admin:admin@127.0.0.1:8080/v1/inventory/agents/f56ee4e8-116c-496b-812f-a803dd2fe88d |
| 18 | + |
| 19 | +### POST /v1/inventory/Agents/Get -> GET /v1/inventory/agents/{agent_id} |
| 20 | +curl -s -X GET http://admin:admin@127.0.0.1:8080/v1/inventory/agents/02ecd9e3-d7b8-4d94-9c75-060b8e6e3e84 |
| 21 | + |
| 22 | +### POST /v1/inventory/Agents/List -> GET /v1/inventory/agents?agent_type=AGENT_TYPE_POSTGRES_EXPORTER |
| 23 | +curl -s -X GET http://admin:admin@127.0.0.1:8080/v1/inventory/agents |
| 24 | +curl -s -X GET http://admin:admin@localhost:8080/v1/inventory/agents?agent_type=AGENT_TYPE_POSTGRES_EXPORTER |
| 25 | +curl -s -X GET http://admin:admin@localhost:8080/v1/inventory/agents?agent_type=AGENT_TYPE_PMM_AGENT |
| 26 | +curl -s -X GET http://admin:admin@localhost:8080/v1/inventory/agents?pmm_agent_id=pmm-server |
| 27 | +curl -s -X GET http://admin:admin@localhost:8080/v1/inventory/agents?pmm_agent_id=/agent_id/02ecd9e3-d7b8-4d94-9c75-060b8e6e3e84 |
| 28 | +curl -s -X GET http://admin:admin@localhost:8080/v1/inventory/agents?pmm_agent_id=02ecd9e3-d7b8-4d94-9c75-060b8e6e3e84 |
| 29 | +curl -s -X GET http://admin:admin@localhost:8080/v1/inventory/agents?service_id=/service_id/6984244c-0a18-4508-a219-3977e8fb01d0 |
| 30 | +curl -s -X GET http://admin:admin@localhost:8080/v1/inventory/agents?service_id=6984244c-0a18-4508-a219-3977e8fb01d0 |
| 31 | + |
| 32 | +### POST /v1/inventory/Agents/GetLogs - GET /v1/inventory/agents/{agent_id}/logs |
| 33 | +curl -s -X GET http://admin:admin@localhost:8080/v1/inventory/agents/49bef198-299c-41b3-ba05-578defe63678/logs |
| 34 | +curl -s -X GET http://admin:admin@localhost:8080/v1/inventory/agents/49bef198-299c-41b3-ba05-578defe63678/logs?limit=10 |
| 35 | + |
| 36 | +### POST /v1/inventory/Nodes/Get -> GET /v1/inventory/nodes/{node_id} |
| 37 | +curl -s -X GET http://admin:admin@localhost:8080/v1/inventory/nodes/32c914d1-daf0-468a-aa9d-4ebb65ab2ee9 |
| 38 | + |
| 39 | +### POST /v1/inventory/Services/Get -> GET /v1/inventory/services/{service_id} |
| 40 | +curl -s -X GET http://admin:admin@localhost:8080/v1/inventory/services/d4dfdccf-c07c-48a6-a101-b119b04d880f |
| 41 | + |
| 42 | +### POST /v1/inventory/Services/Change -> PUT /v1/inventory/services/{service_id} |
| 43 | +curl -s -X PUT -d '{"cluster": "test2","environment":"dev","replication_set":"main"}' http://admin:admin@localhost:8080/v1/inventory/services/d4dfdccf-c07c-48a6-a101-b119b04d880f |
| 44 | +### add/update custom labels |
| 45 | +curl -s -X PUT -d '{"custom_labels":{"values":{"env":"foo","bar":"123"}}}' http://admin:admin@localhost:8080/v1/inventory/services/d4dfdccf-c07c-48a6-a101-b119b04d880f |
| 46 | +### remove a standard label and all custom labels |
| 47 | +curl -s -X PUT -d '{"replication_set":"","custom_labels":{}}' http://admin:admin@localhost:8080/v1/inventory/services/d4dfdccf-c07c-48a6-a101-b119b04d880f |
| 48 | + |
| 49 | +### POST /v1/inventory/Services/ListTypes -> POST /v1/inventory/services:getTypes |
| 50 | +curl -s -X POST http://admin:admin@localhost:8080/v1/inventory/services:getTypes |
0 commit comments