API v1#

The API version 1 uses the OpenAPI Specification for its documentation. You can directly interect with the API documentation:

Listing 1 OpenAPI Schema#
  1openapi: 3.0.3
  2info:
  3  title: Fit4Cybersecurity API documentation.
  4  version: 2.1.0
  5  description: Documentation of the Fit4Cybersecurity API.
  6  contact:
  7    email: opensource@nc3.lu
  8  license:
  9    name: GNU Affero General Public License version 3
 10    url: https://www.gnu.org/licenses/agpl-3.0.html
 11paths:
 12  /survey/api/v1/recommendation/:
 13    get:
 14      operationId: recommendation_retrieve
 15      description: List all the items.
 16      tags:
 17      - recommendation
 18      security:
 19      - cookieAuth: []
 20      - basicAuth: []
 21      responses:
 22        '200':
 23          description: No response body
 24  /survey/api/v1/schema/:
 25    get:
 26      operationId: schema_retrieve
 27      description: |-
 28        OpenApi3 schema for this API. Format can be selected via content negotiation.
 29
 30        - YAML: application/vnd.oai.openapi
 31        - JSON: application/vnd.oai.openapi+json
 32      parameters:
 33      - in: query
 34        name: format
 35        schema:
 36          type: string
 37          enum:
 38          - json
 39          - yaml
 40      - in: query
 41        name: lang
 42        schema:
 43          type: string
 44          enum:
 45          - de
 46          - en
 47          - fr
 48      tags:
 49      - schema
 50      security:
 51      - basicAuth: []
 52      - cookieAuth: []
 53      - {}
 54      responses:
 55        '200':
 56          content:
 57            application/vnd.oai.openapi:
 58              schema:
 59                type: object
 60                additionalProperties: {}
 61            application/yaml:
 62              schema:
 63                type: object
 64                additionalProperties: {}
 65            application/vnd.oai.openapi+json:
 66              schema:
 67                type: object
 68                additionalProperties: {}
 69            application/json:
 70              schema:
 71                type: object
 72                additionalProperties: {}
 73          description: ''
 74  /survey/api/v1/survey_question/:
 75    get:
 76      operationId: survey_question_retrieve
 77      description: List all the items.
 78      tags:
 79      - survey_question
 80      security:
 81      - cookieAuth: []
 82      - basicAuth: []
 83      responses:
 84        '200':
 85          description: No response body
 86  /survey/api/v1/survey_question_answer/:
 87    get:
 88      operationId: survey_question_answer_retrieve
 89      description: List all the items.
 90      tags:
 91      - survey_question_answer
 92      security:
 93      - cookieAuth: []
 94      - basicAuth: []
 95      responses:
 96        '200':
 97          description: No response body
 98  /survey/api/v1/survey_section/:
 99    get:
100      operationId: survey_section_retrieve
101      description: List all the items.
102      tags:
103      - survey_section
104      security:
105      - cookieAuth: []
106      - basicAuth: []
107      responses:
108        '200':
109          description: No response body
110  /survey/api/v1/survey_user/:
111    get:
112      operationId: survey_user_retrieve
113      description: Get all the items.
114      tags:
115      - survey_user
116      security:
117      - cookieAuth: []
118      - basicAuth: []
119      responses:
120        '200':
121          description: No response body
122  /survey/api/v1/survey_user/{id}/:
123    get:
124      operationId: survey_user_retrieve_2
125      description: Get an item.
126      parameters:
127      - in: path
128        name: id
129        schema:
130          type: string
131          format: uuid
132        required: true
133      tags:
134      - survey_user
135      security:
136      - cookieAuth: []
137      - basicAuth: []
138      responses:
139        '200':
140          description: No response body
141  /survey/api/v1/survey_user_answer/{id}/:
142    get:
143      operationId: survey_user_answer_retrieve
144      description: Get an item.
145      parameters:
146      - in: path
147        name: id
148        schema:
149          type: string
150          format: uuid
151        required: true
152      tags:
153      - survey_user_answer
154      security:
155      - cookieAuth: []
156      - basicAuth: []
157      responses:
158        '200':
159          description: No response body
160components:
161  securitySchemes:
162    basicAuth:
163      type: http
164      scheme: basic
165    cookieAuth:
166      type: apiKey
167      in: cookie
168      name: sessionid

Updating the OpenAPI Schema#

If you have updated the API, you can generate a new OpenAPI Schema:

$ python manage.py spectacular --format openapi --file docs/static/openapi-schema.yml

This file is included in the documentation of Fit4Cybersecurity.