Skip to main content

oneterm interface document

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 NameExample valueParameter Typeis requiredParameter Description
    parent_id1intYesParent Folder id
    nameAsset1stringYesAsset name, unique
    commentNote 1stringNoAsset Note
    ip192.168.20.82stringNoAsset ip
    protocols[ssh:22][]stringNoList of protocols and port combinations
    gateway_id1intNoGateway id used
    authorization{1:[123, 456]}map[int][]intYesAccounts 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}AccessAuthYesAsset 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 NameExample valueParameter Typeis requiredParameter Description
    nameAsset1stringYesAccount name, unique
    account_type1intYesAccount Type 1 Password 2 Key
    accountRootstringYesAccount
    passwordabc123stringNoAccount Password
    pk--BEGIN RSA PRIVATE KEY --...stringNoPrivate Key
    phrase123456stringNoPhase used when creating private key
  • Result

    {
    "code": 0,
    "data": null,
    "message": "ok"
    }