Update 'api.md'
This commit is contained in:
parent
c83395720d
commit
5800a0603e
36
api.md
36
api.md
@ -1,3 +1,37 @@
|
||||
## get host info
|
||||
```bash
|
||||
curl -H "auth-token: 8eff4f16-086d-40fd-acbd-7634b9a36117" http://localhost:3000/api/mine.com
|
||||
```
|
||||
|
||||
* 200 {"host":"yours.com","results":{"ip":"127.0.0.1:4000","updated":"1518595297563","username":"test10"}}
|
||||
* 404 {"host":"mine.comf","results":null}
|
||||
|
||||
|
||||
## view all hosts
|
||||
```bash
|
||||
curl -H "auth-token: 8eff4f16-086d-40fd-acbd-7634b9a36117" http://localhost:3000/api/
|
||||
```
|
||||
|
||||
* 200 {"hosts":["mine.com","mine2.com"]}
|
||||
|
||||
|
||||
## add host
|
||||
```bash
|
||||
curl -H "Content-Type: application/json" -H "auth-token: 8eff4f16-086d-40fd-acbd-7634b9a36117" -X POST -d "{\"host\": \"yours.com\", \"ip\": \"127.0.0.1:4000\"}" http://localhost:3000/api/
|
||||
```
|
||||
|
||||
* 200 {"message":"Host yours.com Added"}
|
||||
* 400 {"message":"Missing fields: ip"}
|
||||
|
||||
|
||||
## delete host
|
||||
```bash
|
||||
curl -H "Content-Type: application/json" -H "auth-token: 8eff4f16-086d-40fd-acbd-7634b9a36117" -X DELETE -d "{\"host\": \"yours.com\"}" http://localhost:3000/api/
|
||||
```
|
||||
|
||||
* 200 {"message":"Host yours.com deleted"}
|
||||
|
||||
|
||||
## invite
|
||||
```bash
|
||||
curl -H "Content-Type: application/json" -H "auth-token: 0b06eb2e-4ca4-4881-9a0f-b8df55431cd1" -X POST http://localhost:3000/users/invite
|
||||
@ -17,6 +51,7 @@ curl -H "Content-Type: application/json" -X POST -d "{\"username\": \"test9\", \
|
||||
* 401 {"message":"Token not valid"}
|
||||
* 409 {"message":"username taken"}
|
||||
|
||||
|
||||
## login
|
||||
```bash
|
||||
curl -H "Content-Type: application/json" -X POST -d "{\"username\": \"test8\", \"password\": \"palm7\"}" http://localhost:3000/auth/login
|
||||
@ -32,6 +67,7 @@ curl -H "Content-Type: application/json" -X POST -d "{\"key\":\"ssh-rsa AAAAB3Nz
|
||||
* 200 {"info":"4096 SHA256:dfdCYzt0atMBXVZTJzUxsu99IjXXFXpocSox5q+jOs8 wmantly@gmail.co (RSA)\n"}
|
||||
* 400 {"message":"Key is not a public key file!"}
|
||||
|
||||
|
||||
## add ssh key to current user
|
||||
```bash
|
||||
curl -H "Content-Type: application/json" -H "auth-token: 8eff4f16-086d-40fd-acbd-7634b9a36117" -X POST -d "{\"key\": \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDM9vboz5YGgESsrR2e4JOeP2qtmQo2S8BjI+Y/VxPQ6WbNFzAkXxDniHcnPCrhkeX36SKINvMjWnt4XOK2S+X+1tCoXJzqtcKKyK0gx8ijBxcWVPxsMWjMYTGSVSKiKnt6CyQzrbVGJMh3iAQ8Yv1JwH+6SAtMgT8it7iLyntNFJCesh4I/znEG58A5VBbdUle1Ztz9afjj1CZns17jk7KPm9ig5DmuvdvnMEfhFjfKv1Rp6S5nxacMoTP4tJNSEUh55IicoWk94ii5GwUVLYgyMmzdlA32TqVLFpU2yAvdA9WSnBaI/ZyktlfI7YAmK2wFBsagr9Pq1TcUAY6rZ/GTMjDxExgdYn/FxlufcuqeNJsJXs2A+0xDS/9mv/yGQzNZrL8DrVhY2OKKLoH4Q7enDbhSgEFmJUJMqPxuPEgLEvKfzcURSvIwRj1iCEw6S4dhdaLJl2RRBb1ZWBQbE5ogIbvAl7GFJUAhj3pqYJnd30VENv1MkK+IoCS7EEP0caqL9RNAId0Plud7q2XElHqzkYUE+z+Q/LvGgclXK1ZmZejNaMnV53wfhAevfwVyNGK9i5gbwc1P2lplIa5laXCcVWezqELEkTpdjp4AeKmMuCr8rY8EnLKIcKWEOsX5UumztCow6e1E55v3VeHvRZLpw4DZP7EE0Q8B/jPFWqbCw== wmantly@gmail.co\"}" http://localhost:3000/users/key
|
||||
|
Loading…
x
Reference in New Issue
Block a user