mirror of
https://github.com/gravitl/netmaker.git
synced 2024-09-21 15:56:07 +08:00
Update API.md
This commit is contained in:
parent
ffa49c8634
commit
56da9e0d76
24
docs/API.md
24
docs/API.md
|
@ -44,7 +44,9 @@ In general, requests will take the format of `curl -H "Authorization: Bearer <YO
|
|||
## ACCESS KEYS
|
||||
|
||||
**Get All Keys:** `/api/networks/{network id}/keys`, `GET`
|
||||
|
||||
**Create Key:** `/api/networks/{network id}/keys`, `GET`
|
||||
|
||||
**Delete Key:** `/api/networks/{network id}/keys/{keyname}`, `DELETE`
|
||||
|
||||
### Access Key API Call Examples
|
||||
|
@ -58,21 +60,32 @@ In general, requests will take the format of `curl -H "Authorization: Bearer <YO
|
|||
## NODES (COMPUTERS)
|
||||
|
||||
**Get All Nodes:** `/api/nodes`, `GET`
|
||||
|
||||
**Get Network Nodes:** `/api/nodes/{network id}`, `GET`
|
||||
|
||||
**Create Node:** `/api/nodes/{network id}`, `POST`
|
||||
|
||||
**Get Node:** `/api/nodes/{network id}/{macaddress}`, `GET`
|
||||
|
||||
**Update Node:** `/api/nodes/{network id}/{macaddress}`, `PUT`
|
||||
|
||||
**Delete Node:** `/api/nodes/{network id}/{macaddress}`, `DELETE`
|
||||
|
||||
**Check In Node:** `/api/nodes/{network id}/{macaddress}/checkin`, `POST`
|
||||
|
||||
**Create a Gateway:** `/api/nodes/{network id}/{macaddress}/creategateway`, `POST`
|
||||
|
||||
**Delete a Gateway:** `/api/nodes/{network id}/{macaddress}/deletegateway`, `DELETE`
|
||||
|
||||
**Uncordon (Approve) a Pending Node:** `/api/nodes/{network id}/{macaddress}/uncordon`, `POST`
|
||||
|
||||
**Get Last Modified Date (Last Modified Node in Network):** `/api/nodes/adm/{network id}/lastmodified`, `GET`
|
||||
|
||||
**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 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`
|
||||
|
||||
|
@ -99,13 +112,18 @@ In general, requests will take the format of `curl -H "Authorization: Bearer <YO
|
|||
**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`
|
||||
|
||||
**Update User:** `/api/users/{username}`, `PUT`
|
||||
|
||||
**Delete User:** `/api/users/{username}`, `DELETE`
|
||||
|
||||
**Check for Admin User:** `/api/users/adm/hasadmin`, `GET`
|
||||
|
||||
**Create Admin User:** `/api/users/adm/createadmin`, `POST`
|
||||
|
||||
**Authenticate:** `/api/users/adm/authenticate`, `POST`
|
||||
|
||||
**Get User:**`curl -H "Authorization: Bearer YOUR_SECRET_KEY" http://localhost:8081/api/users/{username} | jq`
|
||||
**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}`
|
||||
|
||||
|
@ -115,7 +133,7 @@ In general, requests will take the format of `curl -H "Authorization: Bearer <YO
|
|||
|
||||
**Create Admin User:** `curl -d '{ "username": "smartguy", "password": "YOUR_PASS"}' -H 'Content-Type: application/json' -H "authorization: Bearer YOUR_SECRET_KEY" localhost:8081/api/users/adm/createadmin`
|
||||
|
||||
**Authenticate:** `curl -d '{"username": "smartguy", "password": "YOUR_PASS"}' -H 'Content-Type: application/json' localhost:8081/api/nodes/adm/skynet/authenticate`
|
||||
**Authenticate:** `curl -d '{"username": "smartguy", "password": "YOUR_PASS"}' -H 'Content-Type: application/json' localhost:8081/api/nodes/adm/skynet/authenticate`
|
||||
|
||||
## SERVER MGMT
|
||||
|
||||
|
|
Loading…
Reference in a new issue