openapi: 3.0.0
info:
  title: Strapi REST API
  description: >
    The REST API allows accessing the content-types through API endpoints.
    Strapi automatically creates API endpoints when a content-type is created.
    API parameters can be used when querying API endpoints to refine the
    results.
  version: 4.3.9
servers:
  - url: https://localhost:1337/api
    variables:
      environment:
        default: api
        enum:
          - api
          - api.dev
          - api.staging
      protocol:
        default: https
        enum:
          - http
          - https
paths:
  /api/:pluralposts/{pluralApiId}:
    get:
      tags:
        - Posts
      summary: Return a post
      description: Return a post with postId equals to id.
      parameters:
        - name: id
          in: path
          required: true
          description: The postId requested by user.
          schema:
            type: string
      responses:
        '200':
          description: A blog posts in JSON format
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Entry'
    put:
      tags:
        - Posts
      summary: Update a post
      description: A  complete replacement of a post with id.
      parameters:
        - name: id
          in: path
          required: true
          description: The postId requested by user.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Entry'
      responses:
        '200':
          description: Updated the post completely.
    patch:
      tags:
        - Posts
      summary: Update a post
      description: Update the post with id partially.
      parameters:
        - name: id
          in: path
          required: true
          description: The postId requested by user.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchPost'
      responses:
        '200':
          description: Updated the post partially.
    delete:
      tags:
        - Posts
      summary: Deletes a post
      description: Deletes the post with id.
      parameters:
        - name: id
          in: path
          required: true
          description: The postId requested by user.
          schema:
            type: string
      responses:
        '204':
          description: The resource was deleted successfully.
  /comments:
    get:
      tags:
        - Comments
      summary: Return comments
      description: Return comments on a post with postId={id}.
      parameters:
        - in: query
          name: postId
          schema:
            type: string
          description: The postId which we want the comments
      responses:
        '200':
          description: A list of comments JSON format
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Comments'
components:
  schemas:
    Entries:
      description: An array of post objects.
      type: array
      items:
        $ref: '#/components/schemas/Entry'
      example:
        - userId: 1
          id: 1
          title: First post
          body: This is the first post body.
        - userId: 1
          id: 2
          title: Second post
          body: The second post content.
        - userId: 1
          id: 3
          title: Another post
          body: Other post content
    Entry:
      type: object
      properties:
        id:
          type: string
          description: The post id.
        userId:
          type: string
          description: The post userId.
        title:
          type: string
          description: The title of the post
        body:
          type: string
          description: The body content of the post
      required:
        - id
        - userId
        - title
        - body
      example:
        userId: 1
        id: 1
        title: The First Post
        body: we are building a blog post API using OpenAPI Specification.
    PatchPost:
      type: object
      properties:
        id:
          type: string
          description: The post id.
        userId:
          type: string
          description: The post userId.
        title:
          type: string
          description: The title of the post
        body:
          type: string
          description: The body content of the post
    Comments:
      description: The array of comment objects
      type: array
      items:
        $ref: '#/components/schemas/Comment'
      example:
        - postId: 1
          id: 1
          name: id labore ex et quam laborum
          email: Eliseo@gardner.biz
          body: laudantium enim quasi est quidem magnam voluptate
        - postId: 1
          id: 2
          name: quo vero reiciendis velit similique earum
          email: Jayne_Kuhic@sydney.com
          body: est natus enim nihil est dolore omnis voluptatem
        - postId: 1
          id: 3
          name: odio adipisci rerum aut animi
          email: Nikita@garfield.biz
          body: quia molestiae reprehenderit quasi aspernatur
    Comment:
      type: object
      properties:
        id:
          type: string
          description: The comment id.
        postId:
          type: string
          description: The comment postId.
        name:
          type: string
          description: The name of the comment.
        email:
          type: string
          description: The email of the user who posted the comment.
        body:
          type: string
          description: The comment body.
      example:
        id: 1
        postId: 1
        name: The first comment
        email: example@example.com
        body: This is the first comment!
