2022-01-07 13:45:52 +01:00
|
|
|
openapi: 3.0.0
|
|
|
|
info:
|
|
|
|
version: 1.3.0
|
|
|
|
title: Cerebrate Project API
|
|
|
|
description: |
|
2022-01-10 11:59:55 +01:00
|
|
|
Cerebrate is an open-source platform meant to act as a trusted contact information provider and interconnection orchestrator for other security tools.
|
2022-01-07 13:45:52 +01:00
|
|
|
|
|
|
|
servers:
|
|
|
|
- url: https://cerebrate.local
|
|
|
|
|
|
|
|
tags:
|
|
|
|
- name: Users
|
2022-01-07 17:08:00 +01:00
|
|
|
description: "Users enrolled in this Cerebrate instance."
|
2022-01-07 13:45:52 +01:00
|
|
|
|
|
|
|
paths:
|
2022-01-07 17:08:00 +01:00
|
|
|
/api/v1/users/index:
|
|
|
|
get:
|
|
|
|
summary: "Get users list"
|
|
|
|
operationId: getUsers
|
|
|
|
tags:
|
|
|
|
- Users
|
|
|
|
responses:
|
|
|
|
"200":
|
2022-01-10 11:59:55 +01:00
|
|
|
$ref: "#/components/responses/UserListResponse"
|
2022-01-07 17:08:00 +01:00
|
|
|
"403":
|
|
|
|
$ref: "#/components/responses/UnauthorizedApiErrorResponse"
|
|
|
|
"405":
|
|
|
|
$ref: "#/components/responses/MethodNotAllowedApiErrorResponse"
|
|
|
|
default:
|
|
|
|
$ref: "#/components/responses/ApiErrorResponse"
|
|
|
|
|
2022-01-07 13:45:52 +01:00
|
|
|
/api/v1/users/view:
|
|
|
|
get:
|
|
|
|
summary: "Get information about the current user"
|
|
|
|
operationId: viewUserMe
|
|
|
|
tags:
|
|
|
|
- Users
|
|
|
|
responses:
|
|
|
|
"200":
|
2022-01-10 11:59:55 +01:00
|
|
|
$ref: "#/components/responses/UserResponse"
|
2022-01-07 13:45:52 +01:00
|
|
|
"403":
|
|
|
|
$ref: "#/components/responses/UnauthorizedApiErrorResponse"
|
2022-01-10 11:59:55 +01:00
|
|
|
"405":
|
|
|
|
$ref: "#/components/responses/MethodNotAllowedApiErrorResponse"
|
2022-01-07 13:45:52 +01:00
|
|
|
default:
|
|
|
|
$ref: "#/components/responses/ApiErrorResponse"
|
|
|
|
|
|
|
|
/api/v1/users/view/{userId}:
|
|
|
|
get:
|
|
|
|
summary: "Get information of a user by id"
|
|
|
|
operationId: viewUserById
|
|
|
|
tags:
|
|
|
|
- Users
|
|
|
|
parameters:
|
|
|
|
- $ref: "#/components/parameters/userId"
|
|
|
|
responses:
|
|
|
|
"200":
|
2022-01-10 11:59:55 +01:00
|
|
|
$ref: "#/components/responses/UserResponse"
|
|
|
|
"403":
|
|
|
|
$ref: "#/components/responses/UnauthorizedApiErrorResponse"
|
|
|
|
"405":
|
|
|
|
$ref: "#/components/responses/MethodNotAllowedApiErrorResponse"
|
|
|
|
default:
|
|
|
|
$ref: "#/components/responses/ApiErrorResponse"
|
|
|
|
|
|
|
|
/api/v1/users/add:
|
|
|
|
post:
|
|
|
|
summary: "Add user"
|
|
|
|
operationId: addUser
|
|
|
|
tags:
|
|
|
|
- Users
|
|
|
|
requestBody:
|
|
|
|
$ref: "#/components/requestBodies/AddUserRequest"
|
|
|
|
responses:
|
|
|
|
"200":
|
|
|
|
$ref: "#/components/responses/UserResponse"
|
|
|
|
"403":
|
|
|
|
$ref: "#/components/responses/UnauthorizedApiErrorResponse"
|
|
|
|
"405":
|
|
|
|
$ref: "#/components/responses/MethodNotAllowedApiErrorResponse"
|
|
|
|
default:
|
|
|
|
$ref: "#/components/responses/ApiErrorResponse"
|
|
|
|
|
|
|
|
/api/v1/users/edit:
|
|
|
|
put:
|
|
|
|
summary: "Edit current user"
|
|
|
|
operationId: editUser
|
|
|
|
tags:
|
|
|
|
- Users
|
|
|
|
requestBody:
|
|
|
|
$ref: "#/components/requestBodies/EditUserRequest"
|
|
|
|
responses:
|
|
|
|
"200":
|
|
|
|
$ref: "#/components/responses/UserResponse"
|
2022-01-07 13:45:52 +01:00
|
|
|
"403":
|
|
|
|
$ref: "#/components/responses/UnauthorizedApiErrorResponse"
|
2022-01-10 11:59:55 +01:00
|
|
|
"405":
|
|
|
|
$ref: "#/components/responses/MethodNotAllowedApiErrorResponse"
|
|
|
|
default:
|
|
|
|
$ref: "#/components/responses/ApiErrorResponse"
|
|
|
|
|
|
|
|
/api/v1/users/edit/{userId}:
|
|
|
|
put:
|
|
|
|
summary: "Edit current user"
|
|
|
|
operationId: editUserById
|
|
|
|
tags:
|
|
|
|
- Users
|
|
|
|
parameters:
|
|
|
|
- $ref: "#/components/parameters/userId"
|
|
|
|
requestBody:
|
|
|
|
$ref: "#/components/requestBodies/EditUserRequest"
|
|
|
|
responses:
|
|
|
|
"200":
|
|
|
|
$ref: "#/components/responses/UserResponse"
|
|
|
|
"403":
|
|
|
|
$ref: "#/components/responses/UnauthorizedApiErrorResponse"
|
|
|
|
"405":
|
|
|
|
$ref: "#/components/responses/MethodNotAllowedApiErrorResponse"
|
|
|
|
default:
|
|
|
|
$ref: "#/components/responses/ApiErrorResponse"
|
|
|
|
|
|
|
|
/api/v1/users/delete/{userId}:
|
|
|
|
delete:
|
|
|
|
summary: "Delete user by ID"
|
|
|
|
operationId: deleteUserById
|
|
|
|
tags:
|
|
|
|
- Users
|
|
|
|
parameters:
|
|
|
|
- $ref: "#/components/parameters/userId"
|
|
|
|
responses:
|
|
|
|
"200":
|
|
|
|
$ref: "#/components/responses/UserResponse"
|
|
|
|
"403":
|
|
|
|
$ref: "#/components/responses/UnauthorizedApiErrorResponse"
|
|
|
|
"405":
|
|
|
|
$ref: "#/components/responses/MethodNotAllowedApiErrorResponse"
|
2022-01-07 13:45:52 +01:00
|
|
|
default:
|
|
|
|
$ref: "#/components/responses/ApiErrorResponse"
|
|
|
|
|
|
|
|
components:
|
|
|
|
schemas:
|
|
|
|
# General
|
|
|
|
UUID:
|
|
|
|
type: string
|
|
|
|
format: uuid
|
|
|
|
maxLength: 36
|
|
|
|
example: "c99506a6-1255-4b71-afa5-7b8ba48c3b1b"
|
|
|
|
|
|
|
|
ID:
|
|
|
|
type: integer
|
|
|
|
format: int32
|
|
|
|
example: 1
|
|
|
|
|
|
|
|
DateTime:
|
|
|
|
type: string
|
|
|
|
format: datetime
|
|
|
|
example: "2022-01-05T11:19:26+00:00"
|
|
|
|
|
|
|
|
# Users
|
|
|
|
Username:
|
|
|
|
type: string
|
|
|
|
example: "admin"
|
|
|
|
|
|
|
|
User:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
id:
|
|
|
|
$ref: "#/components/schemas/ID"
|
|
|
|
uuid:
|
|
|
|
$ref: "#/components/schemas/UUID"
|
|
|
|
username:
|
|
|
|
$ref: "#/components/schemas/Username"
|
|
|
|
role_id:
|
|
|
|
$ref: "#/components/schemas/ID"
|
|
|
|
individual_id:
|
|
|
|
$ref: "#/components/schemas/ID"
|
|
|
|
disabled:
|
|
|
|
type: boolean
|
|
|
|
created:
|
|
|
|
$ref: "#/components/schemas/DateTime"
|
|
|
|
modified:
|
|
|
|
$ref: "#/components/schemas/DateTime"
|
|
|
|
organisation_id:
|
|
|
|
$ref: "#/components/schemas/ID"
|
|
|
|
|
2022-01-07 17:08:00 +01:00
|
|
|
UserList:
|
|
|
|
type: array
|
|
|
|
items:
|
|
|
|
$ref: "#/components/schemas/User"
|
|
|
|
|
2022-01-07 13:45:52 +01:00
|
|
|
# Individuals
|
|
|
|
|
|
|
|
# Organisations
|
|
|
|
|
|
|
|
# Roles
|
|
|
|
RoleName:
|
|
|
|
type: string
|
|
|
|
maxLength: 255
|
|
|
|
example: "admin"
|
|
|
|
|
|
|
|
Role:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
id:
|
|
|
|
$ref: "#/components/schemas/ID"
|
|
|
|
name:
|
|
|
|
$ref: "#/components/schemas/RoleName"
|
|
|
|
is_default:
|
|
|
|
type: boolean
|
|
|
|
perm_admin:
|
|
|
|
type: boolean
|
|
|
|
perm_sync:
|
|
|
|
type: boolean
|
|
|
|
perm_org_admin:
|
|
|
|
type: boolean
|
|
|
|
|
|
|
|
# Errors
|
|
|
|
ApiError:
|
|
|
|
type: object
|
|
|
|
required:
|
|
|
|
- message
|
|
|
|
- url
|
2022-01-07 17:08:00 +01:00
|
|
|
- code
|
2022-01-07 13:45:52 +01:00
|
|
|
properties:
|
|
|
|
message:
|
|
|
|
type: string
|
|
|
|
url:
|
|
|
|
type: string
|
2022-01-07 17:08:00 +01:00
|
|
|
example: "/api/v1/users"
|
|
|
|
code:
|
|
|
|
type: integer
|
|
|
|
example: 500
|
2022-01-07 13:45:52 +01:00
|
|
|
|
|
|
|
UnauthorizedApiError:
|
|
|
|
type: object
|
|
|
|
required:
|
|
|
|
- message
|
|
|
|
- url
|
2022-01-07 17:08:00 +01:00
|
|
|
- code
|
2022-01-07 13:45:52 +01:00
|
|
|
properties:
|
2022-01-07 17:08:00 +01:00
|
|
|
message:
|
2022-01-07 13:45:52 +01:00
|
|
|
type: string
|
|
|
|
example: "Authentication failed. Please make sure you pass the API key of an API enabled user along in the Authorization header."
|
2022-01-07 17:08:00 +01:00
|
|
|
url:
|
|
|
|
type: string
|
|
|
|
example: "/api/v1/users"
|
|
|
|
code:
|
|
|
|
type: integer
|
|
|
|
example: 403
|
|
|
|
|
|
|
|
MethodNotAllowedApiError:
|
|
|
|
type: object
|
|
|
|
required:
|
|
|
|
- message
|
|
|
|
- url
|
|
|
|
- code
|
|
|
|
properties:
|
2022-01-07 13:45:52 +01:00
|
|
|
message:
|
|
|
|
type: string
|
2022-01-07 17:08:00 +01:00
|
|
|
example: "You do not have permission to use this functionality."
|
2022-01-07 13:45:52 +01:00
|
|
|
url:
|
|
|
|
type: string
|
2022-01-07 17:08:00 +01:00
|
|
|
example: "/api/v1/users/index"
|
|
|
|
code:
|
|
|
|
type: integer
|
|
|
|
example: 405
|
2022-01-07 13:45:52 +01:00
|
|
|
|
|
|
|
NotFoundApiError:
|
|
|
|
type: object
|
|
|
|
required:
|
|
|
|
- message
|
|
|
|
- url
|
2022-01-07 17:08:00 +01:00
|
|
|
- code
|
2022-01-07 13:45:52 +01:00
|
|
|
properties:
|
|
|
|
message:
|
|
|
|
type: string
|
|
|
|
example: "Invalid user"
|
|
|
|
url:
|
|
|
|
type: string
|
2022-01-07 17:08:00 +01:00
|
|
|
example: "/api/v1/users/users/view/1234"
|
|
|
|
code:
|
|
|
|
type: integer
|
|
|
|
example: 404
|
2022-01-07 13:45:52 +01:00
|
|
|
|
|
|
|
parameters:
|
|
|
|
userId:
|
|
|
|
name: userId
|
|
|
|
in: path
|
|
|
|
description: "Numeric ID of the User"
|
|
|
|
required: true
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/ID"
|
|
|
|
|
|
|
|
securitySchemes:
|
|
|
|
ApiKeyAuth:
|
|
|
|
type: apiKey
|
|
|
|
in: header
|
|
|
|
name: Authorization
|
|
|
|
description: |
|
|
|
|
The authorization is performed by using the following header in the HTTP requests:
|
|
|
|
|
|
|
|
Authorization: YOUR_API_KEY
|
|
|
|
|
2022-01-10 11:59:55 +01:00
|
|
|
requestBodies:
|
|
|
|
AddUserRequest:
|
|
|
|
required: true
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
individual_id:
|
|
|
|
$ref: "#/components/schemas/ID"
|
|
|
|
organisation_id:
|
|
|
|
$ref: "#/components/schemas/ID"
|
|
|
|
role_id:
|
|
|
|
$ref: "#/components/schemas/ID"
|
|
|
|
disabled:
|
|
|
|
type: boolean
|
|
|
|
username:
|
|
|
|
$ref: "#/components/schemas/Username"
|
|
|
|
password:
|
|
|
|
type: string
|
|
|
|
|
|
|
|
EditUserRequest:
|
|
|
|
required: true
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
individual_id:
|
|
|
|
$ref: "#/components/schemas/ID"
|
|
|
|
organisation_id:
|
|
|
|
$ref: "#/components/schemas/ID"
|
|
|
|
role_id:
|
|
|
|
$ref: "#/components/schemas/ID"
|
|
|
|
disabled:
|
|
|
|
type: boolean
|
|
|
|
username:
|
|
|
|
$ref: "#/components/schemas/Username"
|
|
|
|
password:
|
|
|
|
type: string
|
2022-01-07 13:45:52 +01:00
|
|
|
|
|
|
|
responses:
|
|
|
|
# User
|
2022-01-10 11:59:55 +01:00
|
|
|
UserResponse:
|
2022-01-07 13:45:52 +01:00
|
|
|
description: "User response"
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/User"
|
|
|
|
|
2022-01-10 11:59:55 +01:00
|
|
|
UserListResponse:
|
|
|
|
description: "Users list response"
|
2022-01-07 17:08:00 +01:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/UserList"
|
|
|
|
|
2022-01-07 13:45:52 +01:00
|
|
|
# Errors
|
|
|
|
ApiErrorResponse:
|
|
|
|
description: "Unexpected API error"
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/ApiError"
|
|
|
|
|
|
|
|
UnauthorizedApiErrorResponse:
|
|
|
|
description: "Authentication failed. Please make sure you pass the API key of an API enabled user along in the Authorization header."
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/UnauthorizedApiError"
|
|
|
|
|
2022-01-07 17:08:00 +01:00
|
|
|
MethodNotAllowedApiErrorResponse:
|
|
|
|
description: "Method not allowed. Your User Role is not allowed to access this resource."
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/MethodNotAllowedApiError"
|
|
|
|
|
2022-01-07 13:45:52 +01:00
|
|
|
security:
|
|
|
|
- ApiKeyAuth: []
|