1
0
Fork 0
mirror of https://github.com/ThomasGsp/HyperProxmox.git synced 2025-03-09 15:40:18 +00:00

Doc - api info

This commit is contained in:
Tlams 2018-05-02 16:06:21 +01:00
parent afaf640f0e
commit bd03e894fd
2 changed files with 82 additions and 21 deletions

View file

@ -1,15 +1,22 @@
# API Information # API Information
List of all API access available.
Examples are available in the next page.
### Instance status management ### Instance status management
``` bash ``` bash
'/api/v1/instance/id/<MongoID>/status/(start|stop|current|reset|shutdown)' | GET '/api/v1/instance/id/<MongoID>/status/(start|stop|current|reset|shutdown)' | GET
'/api/v1/static/instances/<date>|last/<cluster>/<node>/<vmid>/(start|stop|current|reset|shutdown)' | GET
``` ```
### Cluster management ### Cluster management
``` bash ``` bash
'/api/v1/administration/cluster/<cluster>' | GET - Return the informations for an specific cluster '/api/v1/administration/cluster/<cluster>' | GET - Return the informations for an specific cluster
| PUT - Update the configurations for an specific cluster | PUT - Update the configurations for an specific cluster
| DELETE - Delete the configuration for an specific cluster | DELETE - Delete the configuration for an specific cluster
| POST - Insert a new cluster
'/api/v1/administration/cluster' | GET - Return all clusters information '/api/v1/administration/cluster' | GET - Return all clusters information
@ -26,30 +33,30 @@ This data are manage by the crawler, you can't insert or change data yourself
``` bash ``` bash
# date/cluster/node/vmid # date/cluster/node/vmid
# Disks mapping # Disks mapping
'/api/v1/static/disks/<date>/<cluster>/<node>/<vmid>' | GET - Return the informations for an specific disk '/api/v1/static/disks/<date>|last/<cluster>/<node>/<vmid>' | GET - Return the informations for an specific disk
'/api/v1/static/disks/<date>/<cluster>/<node>/' | GET - Return all disks used in a node '/api/v1/static/disks/<date>|last/<cluster>/<node>/' | GET - Return all disks used in a node
'/api/v1/static/disks/<date>/<cluster>/' | GET - Return all disks used in a cluster '/api/v1/static/disks/<date>|last/<cluster>/' | GET - Return all disks used in a cluster
'/api/v1/static/disks/<date>/' | GET - Return all disks '/api/v1/static/disks/<date>|last/' | GET - Return all disks
# Storages mapping # Storages mapping
'/api/v1/static/storages/<date>/<cluster>/<node>/' | GET - Return all storage used in a node '/api/v1/static/storages/<date>|last/<cluster>/<node>/' | GET - Return all storage used in a node
'/api/v1/static/storages/<date>/<cluster>/' | GET - Return all storages used in a cluster '/api/v1/static/storages/<date>|last/<cluster>/' | GET - Return all storages used in a cluster
'/api/v1/static/storages/<date>/' | GET - Return all storages '/api/v1/static/storages/<date>|last/' | GET - Return all storages
# Instances mapping # Instances mapping
'/api/v1/static/instances/<date>/<cluster>/<node>/<vmid>' | GET - Return the informations for an specific instance '/api/v1/static/instances/<date>|last/<cluster>/<node>/<vmid>' | GET - Return the informations for an specific instance
'/api/v1/static/instances/<date>/<cluster>/<node>/' | GET - Return all instances for a node '/api/v1/static/instances/<date>|last/<cluster>/<node>/' | GET - Return all instances for a node
'/api/v1/static/instances/<date>/<cluster>/' | GET - Return all instances for a cluster '/api/v1/static/instances/<date>|last/<cluster>/' | GET - Return all instances for a cluster
'/api/v1/static/instances/<date>/' | GET - Return all instances (the dump can be very big, in a large infrastructure) '/api/v1/static/instances/<date>|last/' | GET - Return all instances (the dump can be very big, in a large infrastructure)
# Nodes mapping # Nodes mapping
'/api/v1/static/nodes/<date>/<cluster>/<node>' | GET - Return the informations for an specific node '/api/v1/static/nodes/<date>|last/<cluster>/<node>' | GET - Return the informations for an specific node
'/api/v1/static/nodes/<date>/<cluster>/' | GET - Return all nodes for a cluster '/api/v1/static/nodes/<date>|last/<cluster>/' | GET - Return all nodes for a cluster
'/api/v1/static/nodes/<date>/' | GET - Return all nodes '/api/v1/static/nodes/<date>|last/' | GET - Return all nodes
# cluster mapping # cluster mapping
'/api/v1/static/clusters/<date>/<cluster>' | GET - Return the insformations for a specific cluster '/api/v1/static/clusters/<date>|last/<cluster>' | GET - Return the insformations for a specific cluster
'/api/v1/static/clusters/<date>/' | GET - Return all cluster informations '/api/v1/static/clusters/<date>|last/' | GET - Return all cluster informations
# date # date
'/api/v1/static/dates/(all|last)' | GET - Return all or the last date available (generated by the crawler) '/api/v1/static/dates/(all|last)' | GET - Return all or the last date available (generated by the crawler)
@ -57,12 +64,11 @@ This data are manage by the crawler, you can't insert or change data yourself
# mongoid # mongoid
'/api/v1/static/(instances|nodes|clusters|storages|disks)/id/<MongoID>' | GET - Return an information by mongoid '/api/v1/static/(instances|nodes|clusters|storages|disks)/id/<MongoID>' | GET - Return an information by mongoid
``` ```
### Typical use <something> = Change this value
``` bash <date>|last = Two way - Use specific timestamp or select automaticaly the last date
curl http://127.0.0.1:8080/api/v1/static/nodes/1519040226/Cluster_1/sd-817348
```
[Usage - logs](06-logs.md) <-- Previous | Next --> [Usage - General](08-usages.md) [Usage - logs](06-logs.md) <-- Previous | Next --> [Usage - General](08-usages.md)

View file

@ -1,6 +1,8 @@
# Usages # Usages
##  New cluster ## API
###  New cluster
``` bash ``` bash
# Minimum: # Minimum:
curl -H -XPOST -d '{ curl -H -XPOST -d '{
@ -43,4 +45,57 @@ curl -H -XPOST -d '{
* "groups" : Symbolics groups for this node (list) * "groups" : Symbolics groups for this node (list)
* "weight": Weight for the cluster auto-selection (int) [VALUE NOT EMPTY REQUIRED] * "weight": Weight for the cluster auto-selection (int) [VALUE NOT EMPTY REQUIRED]
### Manage virtual machine (status)
To manage an virtual machine, there are two way: use MongoID or the long path.
The first way is probably more efficient in a scripting/program system and the second way for human.
Indeed, it's just a wrapper.
First way:
```bash
# 1 - Get the last date
curl '/api/v1/static/dates/last'
{"value": 1525013945}
# 2 - Get VM-ID
curl 'http://127.0.0.1:8080/api/v1/static/instances/1525188197/Cluster_1/my_node/105'
{"result": "OK", "value": [
{"netin": 0,
"name": "templatevm",
"type": "qemu",
"macaddr": ["BA:B6:C5:8C:F3:55"],
"cluster": "Cluster_1",
"diskread": 0,
"mem": 0,
"maxmem": 1073741824,
"_id": {"$oid": "5ae886660e8d893fd32734e8"},
"disk": 0,
"node": "my_node",
"netout": 0,
"vmid": 105,
"uptime": 0,
"uniqid": "1524672808.5396078_ULBPKPXZ",
"template": "",
"diskwrite": 0,
"status": "stopped",
"cpu": 0,
"maxdisk": 53687091200,
"date": 1525188197,
"cpus": 1,
"pid": null
}
]}
# 3 - Action on VM
curl /api/v1/instance/id/5ae886660e8d893fd32734e8/status/start
{"result": "OK", "value": {"data": "UPID:sd-81592:00006C57:371A9F0B:5AE8884D:qmstart:105:api@pve:"}}%
```
Second:
```bash
curl 'http://127.0.0.1:8080/api/v1/static/instances/last/Cluster_1/my_node/510/stop'
{'data': 'UPID:sd-81592:00003E35:379BC306:5AE9D2E7:qmstop:510:api@pve:'}%
``̀
[Usage - api](07-api.md) <-- Previous [Usage - api](07-api.md) <-- Previous