4.4 - fpmi-hci-2024/project14-1965823945 GitHub Wiki

Документация API

Создание учетной записи

Мы создали учетные записи на сервисах, поддерживающих Open API, с помощью SwaggerHub.

Создать API

API был создан в Postman.

  • 200 OK: Запрос выполнен успешно.
  • 201 Created: Ресурс создан успешно.
  • 400 Bad Request: ошибка клиентского запроса.
  • 404 Not Found: Ресурс не найден.
  • 500 Internal Server Error: Внутренняя ошибка сервера.

POST /api/resource

openapi: 3.0.0 info: description: | This is a sample Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. version: "1.0.0" title: Swagger Petstore termsOfService: 'http://swagger.io/terms/' contact: email: [email protected] license: name: Apache 2.0 url: 'http://www.apache.org/licenses/LICENSE-2.0.html' servers:

Added by API Auto Mocking Plugin

  • description: SwaggerHub API Auto Mocking url: https://virtserver.swaggerhub.com/15800490681LWT_1/lab/1.0.0
  • url: 'https://petstore.swagger.io/v2' tags:
  • name: user description: User Management
  • name: article description: Article Management
  • name: category description: Category Management
  • name: tag description: Tag Management paths: /registration: post: tags: - user summary: Register New User operationId: registerUser responses: '201': description: User registration successful '400': description: Invalid input data '500': description: Internal server error requestBody: content: application/json: schema: $ref: '#/components/schemas/UserData' /login: post: tags: - user summary: User Login operationId: loginUser responses: '200': description: Login successful, returns access token '401': description: Authentication failed '500': description: Internal server error requestBody: content: application/json: schema: $ref: '#/components/schemas/UserData' /articles: get: tags: - article summary: Get All Articles operationId: getArticles responses: '200': description: Successfully retrieved article list content: application/json: schema: type: array items: $ref: '#/components/schemas/Article' '500': description: Internal server error post: tags: - article summary: Create New Article operationId: createArticle responses: '201': description: Article created successfully content: application/json: schema: $ref: '#/components/schemas/Article' '400': description: Invalid input data '500': description: Internal server error requestBody: content: application/json: schema: $ref: '#/components/schemas/ArticleData' /articles/{id}: get: tags: - article summary: Get Specific Article operationId: getArticleById parameters: - name: id in: path description: Article ID required: true schema: type: integer responses: '200': description: Successfully retrieved article content: application/json: schema: $ref: '#/components/schemas/Article' '404': description: Article not found '500': description: Internal server error put: tags: - article summary: Update Specific Article operationId: updateArticle parameters: - name: id in: path description: Article ID required: true schema: type: integer responses: '200': description: Article updated successfully '400': description: Invalid input data '404': description: Article not found '500': description: Internal server error requestBody: content: application/json: schema: $ref: '#/components/schemas/ArticleData' delete: tags: - article summary: Delete Specific Article operationId: deleteArticle parameters: - name: id in: path description: Article ID required: true schema: type: integer responses: '204': description: Article deleted successfully '404': description: Article not found '500': description: Internal server error /categories: post: tags: - category summary: Create New Category operationId: createCategory responses: '201': description: Category created successfully '400': description: Invalid input data requestBody: content: application/json: schema: $ref: '#/components/schemas/Category' /tags: post: tags: - tag summary: Create New Tag operationId: createTag responses: '201': description: Tag created successfully '400': description: Invalid input data requestBody: content: application/json: schema: $ref: '#/components/schemas/Tag' components: schemas: User: type: object required: - id - username - email properties: id: type: integer username: type: string email: type: string UserData: type: object required: - username - password - email properties: username: type: string password: type: string email: type: string Article: type: object required: - id - title - content - author_id properties: id: type: integer title: type: string content: type: string author_id: type: integer created_at: type: string format: date-time updated_at: type: string format: date-time ArticleData: type: object required: - title - content - author_id properties: title: type: string content: type: string author_id: type: integer Category: type: object required: - id - name properties: id: type: integer name: type: string Tag: type: object required: - id - name properties: id: type: integer name: type: string requestBodies: Category: content: application/json: schema: $ref: '#/components/schemas/Category' Tag: content: application/json: schema: $ref: '#/components/schemas/Tag' securitySchemes: api_key: type: apiKey name: api_key in: header security:
  • api_key: [] # Applying the security scheme globally
⚠️ **GitHub.com Fallback** ⚠️