mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-06 03:46:02 +08:00
Update API.md
This commit is contained in:
parent
56da9e0d76
commit
cc068d1eb8
1 changed files with 22 additions and 8 deletions
14
docs/API.md
14
docs/API.md
|
@ -29,6 +29,7 @@ In general, requests will take the format of `curl -H "Authorization: Bearer <YO
|
|||
|
||||
### Network API Call Examples
|
||||
|
||||
|
||||
**Get All Networks:** `curl -H "Authorization: Bearer YOUR_SECRET_KEY" localhost:8081/api/networks | jq`
|
||||
|
||||
**Create Network:** `curl -d '{"addressrange":"10.70.0.0/16","netid":"skynet"}' -H "Authorization: Bearer YOUR_SECRET_KEY" -H 'Content-Type: application/json' localhost:8081/api/networks`
|
||||
|
@ -49,16 +50,20 @@ In general, requests will take the format of `curl -H "Authorization: Bearer <YO
|
|||
|
||||
**Delete Key:** `/api/networks/{network id}/keys/{keyname}`, `DELETE`
|
||||
|
||||
|
||||
### Access Key API Call Examples
|
||||
|
||||
|
||||
**Get All Keys:** `curl -H "Authorization: Bearer YOUR_SECRET_KEY" localhost:8081/api/networks/skynet/keys | jq`
|
||||
|
||||
**Create Key:** `curl -d '{"uses":10,"name":"mykey"}' -H "Authorization: Bearer YOUR_SECRET_KEY" -H 'Content-Type: application/json' localhost:8081/api/networks/skynet/keys`
|
||||
|
||||
**Delete Key:** `curl -X DELETE -H "Authorization: Bearer YOUR_SECRET_KEY" localhost:8081/api/networks/skynet/keys/mykey`
|
||||
|
||||
|
||||
## NODES (COMPUTERS)
|
||||
|
||||
|
||||
**Get All Nodes:** `/api/nodes`, `GET`
|
||||
|
||||
**Get Network Nodes:** `/api/nodes/{network id}`, `GET`
|
||||
|
@ -83,8 +88,10 @@ In general, requests will take the format of `curl -H "Authorization: Bearer <YO
|
|||
|
||||
**Authenticate:** `/api/nodes/adm/{network id}/authenticate`, `POST`
|
||||
|
||||
|
||||
### Example Node API Calls
|
||||
|
||||
|
||||
**Get All Nodes:**`curl -H "Authorization: Bearer YOUR_SECRET_KEY" http://localhost:8081/api/nodes | jq`
|
||||
|
||||
**Get Network Nodes:** `curl -H "Authorization: Bearer YOUR_SECRET_KEY" http://localhost:8081/api/nodes/skynet | jq`
|
||||
|
@ -107,8 +114,10 @@ In general, requests will take the format of `curl -H "Authorization: Bearer <YO
|
|||
|
||||
**Authenticate:** `curl -d '{"macaddress": "8c:90:b5:06:f1:d9", "password": "YOUR_PASSWORD"}' -H 'Content-Type: application/json' localhost:8081/api/nodes/adm/skynet/authenticate`
|
||||
|
||||
|
||||
## USERS
|
||||
|
||||
|
||||
**Note:** Only able to create Admin user at this time. The "user" is only used by the [user interface](https://github.com/gravitl/netmaker-ui) to authenticate the single admin user.
|
||||
|
||||
**Get User:** `/api/users/{username}`, `GET`
|
||||
|
@ -123,6 +132,10 @@ In general, requests will take the format of `curl -H "Authorization: Bearer <YO
|
|||
|
||||
**Authenticate:** `/api/users/adm/authenticate`, `POST`
|
||||
|
||||
|
||||
### Example User API Calls
|
||||
|
||||
|
||||
**Get User:**`curl -H "Authorization: Bearer YOUR_SECRET_KEY" http://localhost:8081/api/users/{username} | jq`
|
||||
|
||||
**Update User:** `curl -X PUT -d '{"password":"noonewillguessthis"}' -H 'Content-Type: application/json' -H "authorization: Bearer YOUR_SECRET_KEY" localhost:8081/api/users/{username}`
|
||||
|
@ -148,4 +161,5 @@ The Server Mgmt. API allows you to add and remove the server from networks.
|
|||
|
||||
## FILE SERVER
|
||||
**Get File:** `/meshclient/files/{filename}`, `GET`
|
||||
|
||||
**Example:** `curl localhost:8081/meshclient/files/meshclient`
|
||||
|
|
Loading…
Add table
Reference in a new issue