oneterm interface document
Note
The swagger document is also available on launch of api at http:///127.0.0.1:58080/swagger/index.html
Asset Interface
Create Asset
-
POST
/api/oneterm/v1/asset
-
Parameters
Parameter Name Example value Parameter Type is required Parameter Description parent_id 1 int Yes Parent Folder id name Asset1 string Yes Asset name, unique comment Note 1 string No Asset Note ip 192.168.20.82 string No Asset ip protocols [ssh:22] []string No List of protocols and port combinations gateway_id 1 int No Gateway id used authorization {1:[123, 456]} map[int][]int Yes Accounts and authorized user list dictionaries, key is an account id and value is an acl rid. accessAuth {“cmd_ids”:[2],“start”:“2024-01-30T00:00:00+08:00”, “end”:“2024-01-31T23:59:59+08:00”, “ranges”:[{“week”:0,“times”:[“00:00:30”]},{“week”:1,”:[]},{“week”:2,“times”:[]},{“week”:4,“times”:[]},{“week”:5,”:[]},{“week”:6,”:[]}],“allow”:true} AccessAuth Yes Asset Access Controls, cmd_ids is a list of command filtering ids, start and end is the time the access control takes effect, ranges is the time selected, allowing or refusing access during the selected time -
Result
{ "code": 0, "data": null, "message": "ok" }
Account Interface
Create Account
-
POST
/api/oneterm/v1/account
-
Parameters
Parameter Name Example value Parameter Type is required Parameter Description name Asset1 string Yes Account name, unique account_type 1 int Yes Account Type 1 Password 2 Key account Root string Yes Account password abc123 string No Account Password pk —BEGIN RSA PRIVATE KEY —… string No Private Key phrase 123456 string No Phase used when creating private key -
Result
{ "code": 0, "data": null, "message": "ok" }