openapi: 3.0.4 info: title: 58TeamBlog version: "1.0" servers: - url: https://58team.ru/api/v1/ tags: - name: admin description: Routes that can be accessed only from localhost - name: user description: Admin user - name: post description: Blog's post - name: posts description: Glue for posts and users paths: /post: put: tags: - admin summary: Update an existing post. description: Update an existing post by Id. operationId: updatePost requestBody: description: Update an existent post content: application/json: schema: $ref: '#/components/schemas/Post' required: true responses: '200': description: Successful operation content: application/json: schema: $ref: '#/components/schemas/Post' '400': description: Invalid ID supplied '404': description: Post not found '422': description: Validation exception default: description: Unexpected error content: application/json: schema: $ref: "#/components/schemas/Error" security: - blog_auth: - write:post - read:post post: tags: - admin summary: Add a new post to the blog. description: Add a new post to the blog. operationId: addPost requestBody: description: Create a new post in the blog content: application/json: schema: $ref: '#/components/schemas/CreatePost' required: true responses: '200': description: Successful operation content: application/json: schema: $ref: '#/components/schemas/Post' '400': description: Invalid input '422': description: Validation exception default: description: Unexpected error content: application/json: schema: $ref: "#/components/schemas/Error" security: - blog_auth: - write:post - read:post /post/user/{name}: get: tags: - post summary: Finds Posts by user name. description: Finds all posts made by user. operationId: findPostsByName parameters: - name: name in: path description: Get all posts by author required: true schema: type: string responses: '200': description: successful operation content: application/json: schema: type: array items: $ref: '#/components/schemas/Post' '400': description: Invalid status value default: description: Unexpected error content: application/json: schema: $ref: "#/components/schemas/Error" /post/{id}: get: tags: - post summary: Get post by id. description: Get post by id. operationId: getPostById parameters: - name: id in: path description: Post id required: true schema: type: string responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/Post' '400': description: Invalid status value default: description: Unexpected error content: application/json: schema: $ref: "#/components/schemas/Error" /posts: get: tags: - posts summary: Get first 5 posts. description: Get first 5 posts. operationId: getPosts responses: '200': description: successful operation content: application/json: schema: type: array items: $ref: '#/components/schemas/Post' default: description: Unexpected error content: application/json: schema: $ref: "#/components/schemas/Error" /posts/{offset}: get: tags: - posts summary: Get 5 posts after %offset% posts. description: Get 5 posts after %offset% posts. operationId: getPostsOffset parameters: - name: offset in: path description: Offset of posts since begin. required: true schema: type: integer responses: '200': description: successful operation content: application/json: schema: type: array items: $ref: '#/components/schemas/Post' /users: get: tags: - admin - users summary: Get all users. description: Get all users. operationId: getUsers responses: '200': description: successful operation content: application/json: schema: type: array items: $ref: '#/components/schemas/User' security: - blog_auth: - read:user components: schemas: User: type: object properties: id: type: string format: uuid example: "f47ac10b-58cc-4372-a567-0e02b2c3d479" username: type: string example: UserName password: type: string format: password example: '$2a$12$bC0iX7kweYs0eGe4RM5oe.TKFfxzvE.s9Hp0v.rY.7BofYMWdqU72' CreatePost: type: object properties: title: type: string example: 'Post title' description: type: string example: "Short content description." content: type: string example: "Some content text." Post: type: object properties: id: type: string format: uuid example: "f47ac10b-58cc-4372-a567-0e02b4f5d479" title: type: string example: 'Post title' description: type: string example: "Short content description." content: type: string example: "Some content text." createdAt: type: string format: date-time updatedAt: type: string format: date-time Error: type: object properties: code: type: string message: type: string required: - code - message requestBodies: Post: description: Post object that needs to be added content: application/json: schema: $ref: '#/components/schemas/Post' securitySchemes: blog_auth: type: oauth2 flows: implicit: authorizationUrl: https://58team.ru/auth scopes: "write:post": modify posts in your account "read:post": read your posts "write:user": modify users "read:user": read users api_key: type: apiKey name: api_key in: header