{ "apidoc": { "version": "0.15.4" }, "name": "users", "organization": { "key": "nclazz" }, "application": { "key": "users" }, "namespace": "de.nclazz.users.v0", "version": "0.0.0-dev-30-gbd50cdf-bd9390b2-staging", "info": { "contact": { "name": "Niclas Thobaben", "url": "https://nclazz.de", "email": "info@nclazz.de" } }, "headers": [ { "name": "x-something", "type": "string", "required": true } ], "imports": [ { "uri": "https://app.apibuilder.io/nclazz/common/latest/service.json", "namespace": "de.nclazz.common.v0", "organization": { "key": "nclazz" }, "application": { "key": "common" }, "version": "0.0.0-dev", "enums": [], "interfaces": [], "unions": [], "models": [ "genericError", "healthcheck" ], "annotations": [ { "name": "personal_data", "description": "Identifies a field that contains Personal Data, as defined by GDPR." } ] }, { "uri": "https://app.apibuilder.io/nclazz/errors/latest/service.json", "namespace": "de.nclazz.errors.v0", "organization": { "key": "nclazz" }, "application": { "key": "errors" }, "version": "0.0.0-dev-24-g9ca2bf7-bd9390b2-staging", "enums": [], "interfaces": [ "error" ], "unions": [], "models": [ "genericError" ], "annotations": [ { "name": "personal_data", "description": "Identifies a field that contains Personal Data, as defined by GDPR." } ] } ], "enums": [ { "name": "userStatus", "plural": "userStatuses", "values": [ { "name": "active", "attributes": [], "description": "User is active and has access to the system." }, { "name": "inactive", "attributes": [], "description": "User is not active and has no access to the system." }, { "name": "created", "attributes": [], "description": "User is created but not has not yet access to the system." }, { "name": "deleted", "attributes": [], "description": "User is deleted and can not access the system. Deleted user will stay in the system for a while, before completely removed." } ], "attributes": [], "description": "Status of a given user or user role." } ], "interfaces": [], "unions": [], "models": [ { "name": "role", "plural": "roles", "fields": [ { "name": "id", "type": "uuid", "required": true, "attributes": [], "annotations": [] }, { "name": "name", "type": "string", "required": true, "attributes": [], "annotations": [], "minimum": 4, "maximum": 64 }, { "name": "created", "type": "date-time-iso8601", "required": true, "attributes": [], "annotations": [] }, { "name": "updated", "type": "date-time-iso8601", "required": true, "attributes": [], "annotations": [] }, { "name": "status", "type": "userStatus", "required": true, "attributes": [], "annotations": [] } ], "attributes": [], "interfaces": [], "description": "Role assigned to a user." }, { "name": "role_form", "plural": "role_forms", "fields": [ { "name": "name", "type": "string", "required": true, "attributes": [], "annotations": [] } ], "attributes": [], "interfaces": [], "description": "Form for creating and updating a new user role." }, { "name": "user", "plural": "users", "fields": [ { "name": "id", "type": "string", "required": true, "attributes": [], "annotations": [], "description": "ID of the user as a 32 char long hex string.", "minimum": 32, "maximum": 32 }, { "name": "name", "type": "string", "required": true, "attributes": [], "annotations": [], "description": "Name of the user, which can be the email address.", "minimum": 8, "maximum": 32 }, { "name": "email", "type": "string", "required": true, "attributes": [], "annotations": [ "personal_data" ], "description": "Email of the user.", "minimum": 4, "maximum": 64 }, { "name": "status", "type": "userStatus", "required": true, "attributes": [], "annotations": [], "description": "Status of the user as described in the user_status enum." }, { "name": "roles", "type": "[role]", "required": true, "attributes": [], "annotations": [], "description": "Roles assigned to the user." } ], "attributes": [], "interfaces": [], "description": "A user defined by an id and an username." }, { "name": "user_form", "plural": "user_forms", "fields": [ { "name": "name", "type": "string", "required": true, "attributes": [], "annotations": [], "description": "Name of the user to be created.", "minimum": 8, "maximum": 32 }, { "name": "email", "type": "string", "required": true, "attributes": [], "annotations": [], "description": "Email of the user to be created.", "minimum": 4, "maximum": 64 } ], "attributes": [], "interfaces": [], "description": "Form for creating and updating a new user." }, { "name": "userLogin", "plural": "userLogins", "fields": [ { "name": "user", "type": "user", "required": true, "attributes": [], "annotations": [] }, { "name": "token", "type": "string", "required": true, "attributes": [], "annotations": [], "minimum": 64, "maximum": 64 }, { "name": "refreshToken", "type": "string", "required": true, "attributes": [], "annotations": [], "minimum": 64, "maximum": 64 } ], "attributes": [], "interfaces": [], "description": "Information and Tokens for the logged in user for authentication." }, { "name": "userLogin_form", "plural": "userLogin_forms", "fields": [ { "name": "username", "type": "string", "required": true, "attributes": [], "annotations": [], "minimum": 8, "maximum": 32 }, { "name": "password", "type": "string", "required": true, "attributes": [], "annotations": [], "minimum": 8, "maximum": 64 } ], "attributes": [], "interfaces": [], "description": "Login Form for username:password authentication." }, { "name": "userStatus_form", "plural": "userStatus_forms", "fields": [ { "name": "status", "type": "userStatus", "required": true, "attributes": [], "annotations": [] } ], "attributes": [], "interfaces": [], "description": "Form for updating the status of a user." } ], "resources": [ { "type": "de.nclazz.common.v0.models.healthcheck", "plural": "healthchecks", "operations": [ { "method": "GET", "path": "/_internal_/healthcheck/healthcheck", "parameters": [], "responses": [ { "code": { "integer": { "value": 200 } }, "type": "de.nclazz.common.v0.models.healthcheck", "description": "Get the current health status of the service.", "attributes": [] } ], "attributes": [], "description": "Simple healthcheck endpoint to test the status of the service." } ], "attributes": [], "path": "/_internal_/healthcheck", "description": "Simple healthcheck resource for monitoring purposes." }, { "type": "role", "plural": "roles", "operations": [ { "method": "GET", "path": "/roles/", "parameters": [], "responses": [ { "code": { "integer": { "value": 200 } }, "type": "[role]", "description": "OK.", "attributes": [] }, { "code": { "integer": { "value": 401 } }, "type": "unit", "description": "Unauthorized.", "attributes": [] } ], "attributes": [], "description": "Get all defined user roles." }, { "method": "GET", "path": "/roles/:id/:other", "parameters": [ { "name": "id", "type": "uuid", "location": "Path", "required": true }, { "name": "other", "type": "string", "location": "Path", "required": true } ], "responses": [ { "code": { "integer": { "value": 200 } }, "type": "role", "description": "User role found.", "attributes": [] }, { "code": { "integer": { "value": 401 } }, "type": "unit", "description": "Unauthorized", "attributes": [] }, { "code": { "integer": { "value": 404 } }, "type": "unit", "description": "User role not found.", "attributes": [] } ], "attributes": [], "description": "Get a user role for id." }, { "method": "POST", "path": "/roles/", "parameters": [], "responses": [ { "code": { "integer": { "value": 201 } }, "type": "user", "description": "User role successfully created.", "attributes": [] }, { "code": { "integer": { "value": 400 } }, "type": "[de.nclazz.errors.v0.models.genericError]", "description": "Bad Request.", "attributes": [] }, { "code": { "integer": { "value": 401 } }, "type": "unit", "description": "Unauthorized.", "attributes": [] } ], "attributes": [], "description": "Create a new user role.", "body": { "type": "role_form", "attributes": [] } }, { "method": "PUT", "path": "/roles/:id/status", "parameters": [ { "name": "id", "type": "uuid", "location": "Path", "required": true } ], "responses": [ { "code": { "integer": { "value": 200 } }, "type": "userStatus", "description": "User role status updated successfully.", "attributes": [] }, { "code": { "integer": { "value": 400 } }, "type": "[de.nclazz.errors.v0.models.genericError]", "description": "Bad Request.", "attributes": [] }, { "code": { "integer": { "value": 401 } }, "type": "unit", "description": "Unauthorized.", "attributes": [] }, { "code": { "integer": { "value": 404 } }, "type": "unit", "description": "Not Found.", "attributes": [] } ], "attributes": [], "description": "Update the status of a user role.", "body": { "type": "userStatus_form", "attributes": [] } }, { "method": "DELETE", "path": "/roles/:id", "parameters": [ { "name": "id", "type": "uuid", "location": "Path", "required": true } ], "responses": [ { "code": { "integer": { "value": 200 } }, "type": "unit", "description": "User role deleted successfully.", "attributes": [] }, { "code": { "integer": { "value": 401 } }, "type": "unit", "description": "Unauthorized.", "attributes": [] }, { "code": { "integer": { "value": 404 } }, "type": "unit", "description": "Not Found.", "attributes": [] } ], "attributes": [], "description": "Mark a user role as deleted. The user role cannot be accessed by the api, but will stay in the db for a while, before completely removed." } ], "attributes": [], "path": "/roles", "description": "Managing user roles." }, { "type": "user", "plural": "users", "operations": [ { "method": "GET", "path": "/users/", "parameters": [ { "name": "x-authorization", "type": "string", "location": "Header", "required": true }, { "name": "x-agent", "type": "string", "location": "Header", "required": false }, { "name": "limit", "type": "integer", "location": "Query", "required": false, "default": 200 } ], "responses": [ { "code": { "integer": { "value": 200 } }, "type": "[user]", "description": "Users found.", "attributes": [] }, { "code": { "integer": { "value": 401 } }, "type": "unit", "description": "Unauthorized.", "attributes": [] } ], "attributes": [], "description": "Get all users." }, { "method": "GET", "path": "/users/:id", "parameters": [ { "name": "id", "type": "string", "location": "Path", "required": true } ], "responses": [ { "code": { "integer": { "value": 200 } }, "type": "user", "description": "User found.", "attributes": [] }, { "code": { "integer": { "value": 404 } }, "type": "unit", "description": "Not found.", "attributes": [] }, { "code": { "integer": { "value": 401 } }, "type": "unit", "description": "Unauthorized.", "attributes": [] } ], "attributes": [], "description": "Get a user for given id." }, { "method": "POST", "path": "/users/", "parameters": [], "responses": [ { "code": { "integer": { "value": 201 } }, "type": "user", "description": "User successfully created.", "attributes": [] }, { "code": { "integer": { "value": 400 } }, "type": "[de.nclazz.errors.v0.models.genericError]", "description": "Bad Request.", "attributes": [] }, { "code": { "integer": { "value": 401 } }, "type": "unit", "description": "Unauthorized.", "attributes": [] } ], "attributes": [], "description": "Create a new user.", "body": { "type": "user_form", "attributes": [] } }, { "method": "PUT", "path": "/users/:id", "parameters": [ { "name": "id", "type": "string", "location": "Path", "required": true } ], "responses": [ { "code": { "integer": { "value": 200 } }, "type": "user", "description": "User updated successfully.", "attributes": [] }, { "code": { "integer": { "value": 400 } }, "type": "[de.nclazz.errors.v0.models.genericError]", "description": "Bad Request.", "attributes": [] }, { "code": { "integer": { "value": 401 } }, "type": "unit", "description": "Unauthorized.", "attributes": [] }, { "code": { "integer": { "value": 404 } }, "type": "unit", "description": "Not Found.", "attributes": [] } ], "attributes": [], "description": "Update user data.", "body": { "type": "user_form", "attributes": [] } }, { "method": "PUT", "path": "/users/:id/status", "parameters": [ { "name": "id", "type": "string", "location": "Path", "required": true } ], "responses": [ { "code": { "integer": { "value": 200 } }, "type": "userStatus", "description": "User status updated successfully.", "attributes": [] }, { "code": { "integer": { "value": 400 } }, "type": "[de.nclazz.errors.v0.models.genericError]", "description": "Bad Request.", "attributes": [] }, { "code": { "integer": { "value": 401 } }, "type": "unit", "description": "Unauthorized.", "attributes": [] }, { "code": { "integer": { "value": 404 } }, "type": "unit", "description": "Not Found.", "attributes": [] } ], "attributes": [], "description": "Update the status of the user.", "body": { "type": "userStatus_form", "attributes": [] } }, { "method": "DELETE", "path": "/users/:id", "parameters": [ { "name": "id", "type": "string", "location": "Path", "required": true } ], "responses": [ { "code": { "integer": { "value": 200 } }, "type": "unit", "description": "User deleted successfully.", "attributes": [] }, { "code": { "integer": { "value": 401 } }, "type": "unit", "description": "Unauthorized.", "attributes": [] }, { "code": { "integer": { "value": 404 } }, "type": "unit", "description": "Not Found.", "attributes": [] } ], "attributes": [], "description": "Mark a user as deleted. The user cannot be accessed by the api, but will stay in the db for a while, before completely removed." } ], "attributes": [], "path": "/users", "description": "Access to the user management." }, { "type": "userLogin", "plural": "userLogins", "operations": [ { "method": "POST", "path": "/login/", "parameters": [], "responses": [ { "code": { "integer": { "value": 200 } }, "type": "userLogin", "description": "User authenticated successfully.", "attributes": [] }, { "code": { "integer": { "value": 401 } }, "type": "unit", "description": "Unauthorized.", "attributes": [] } ], "attributes": [], "description": "Login user with username + password.", "body": { "type": "userLogin_form", "attributes": [] } } ], "attributes": [], "path": "/login", "description": "Resource for authenticating users." } ], "attributes": [], "annotations": [ { "name": "personal_data", "description": "Identifies a field that contains Personal Data, as defined by GDPR." } ], "description": "Service for user management and authentication." }