0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ページネーションの検討

Posted at

大量のデータをスクロール毎に取得するページネーションAPI設計を検討

ページネーションの検討

openapi: 3.0.0
info:
  title: Credit Card Transaction API
  version: 1.0.0
paths:
  /transactions:
    get:
      summary: Retrieve credit card transactions
      description: |
        Retrieves credit card transactions. The initial request returns 50 transactions, and subsequent requests return 30 transactions each.
      parameters:
        - name: userId
          in: query
          required: true
          description: The ID of the user
          schema:
            type: string
            example: 'user123'
        - name: offset
          in: query
          required: false
          description: The offset for pagination
          schema:
            type: integer
            example: 0
      responses:
        '200':
          description: Successfully retrieved transactions
          content:
            application/json:
              schema:
                type: object
                properties:
                  transactions:
                    type: array
                    items:
                      type: object
                      properties:
                        transactionId:
                          type: string
                          description: The ID of the transaction
                          example: 'txn12345'
                        date:
                          type: string
                          format: date-time
                          description: The date of the transaction
                          example: '2023-10-01T12:34:56Z'
                        amount:
                          type: number
                          format: float
                          description: The amount of the transaction
                          example: 123.45
                        description:
                          type: string
                          description: The description of the transaction
                          example: 'Grocery Store'
                  nextOffset:
                    type: integer
                    description: The offset for the next set of transactions
                    example: 50
        '400':
          description: Bad Request - Invalid input data
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: 'Invalid input data'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: 'Internal Server Error'
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?