x-control-panel/api.spec.json

140 lines
3.9 KiB
JSON

{
"Profile" : {
"name" : "Profile",
"methods" : [ {
"name" : "get",
"description" : "Get current user profile",
"return" : "void",
"accessLevel" : "Guest",
"params" : [ ]
}, {
"name" : "save",
"description" : "edit current user profile",
"return" : "boolean",
"accessLevel" : "User",
"params" : [ {
"name" : "login",
"type" : "string",
"description" : "User login. Have to be unique",
"optional" : false
}, {
"name" : "name",
"type" : "string",
"description" : "User display name",
"optional" : false
}, {
"name" : "password",
"type" : "string",
"description" : "Change user password if defined",
"optional" : true
}, {
"name" : "values",
"type" : "object",
"description" : "User custom values",
"optional" : false
} ]
} ]
},
"UserManagement" : {
"name" : "UserManagement",
"methods" : [ {
"name" : "getById",
"description" : "Load user object by ID",
"return" : "object",
"accessLevel" : "Admin",
"params" : [ {
"name" : "id",
"type" : "number",
"description" : "User id",
"optional" : false
} ]
}, {
"name" : "remove",
"description" : "Remove user by ID",
"return" : "object",
"accessLevel" : "Admin",
"params" : [ {
"name" : "id",
"type" : "number",
"description" : "User id",
"optional" : false
} ]
}, {
"name" : "save",
"description" : "Get all users as list",
"return" : "array",
"accessLevel" : "Admin",
"params" : [ {
"name" : "user",
"type" : "object",
"description" : "User object to save",
"optional" : false
} ]
}, {
"name" : "getAll",
"description" : "Get all users as list",
"return" : "array",
"accessLevel" : "Admin",
"params" : [ ]
} ]
},
"Auth" : {
"name" : "Auth",
"methods" : [ {
"name" : "authenticateByPassword",
"description" : "Authenticates a user using login and password. Returns true if authentication is successful.",
"return" : "boolean",
"accessLevel" : "Guest",
"params" : [ {
"name" : "login",
"type" : "string",
"description" : "User's login name",
"optional" : false
}, {
"name" : "password",
"type" : "string",
"description" : "User's password",
"optional" : false
} ]
}, {
"name" : "getTokens",
"description" : "Retrieves all API tokens associated with the current user",
"return" : "array",
"accessLevel" : "User",
"params" : [ ]
}, {
"name" : "generateToken",
"description" : "Generates a new API token and returns its details",
"return" : "object",
"accessLevel" : "User",
"params" : [ {
"name" : "permanent",
"type" : "boolean",
"description" : "If true, creates a token that never expires",
"optional" : true
}, {
"name" : "name",
"type" : "string",
"description" : "Display name for the token. If not provided, the User-Agent header will be used",
"optional" : true
} ]
}, {
"name" : "authenticateByToken",
"description" : "Authenticates a user using an API token. Returns true if authentication is successful.",
"return" : "boolean",
"accessLevel" : "Guest",
"params" : [ {
"name" : "token",
"type" : "string",
"description" : "API token string for authentication",
"optional" : false
} ]
}, {
"name" : "logout",
"description" : "Logs out the current user. Returns true if logout is successful, false if the user is not logged in",
"return" : "boolean",
"accessLevel" : "User",
"params" : [ ]
} ]
}
}