Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
5 views4 pages

YAML OpenAPI 3 Specification

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 4

openapi: 3.0.

info:

version: '1.0.0'

title: 'News Website Comments API'

description: 'API for retrieving comments for news articles.'

paths:

/articles/{articleId}/comments/:

get:

summary: Retrieve paginated comments for a specific news article

description: Returns a list of comments along with user details for display.

parameters:

- name: articleId

in: path

description: Unique identifier of the news article.

required: true

schema:

type: string

- name: limit

in: query

description: Limit the number of comments returned.

required: false

schema:

type: integer

default: 10

- name: offset

in: query

description: Offset for pagination.

required: false
schema:

type: integer

default: 0

responses:

'200':

description: Successful response

content:

application/json:

schema:

type: object

properties:

comments:

type: array

items:

type: object

properties:

commentId:

type: string

description: Unique identifier for the comment.

text:

type: string

description: Text content of the comment.

timestamp:

type: string

format: date-time

description: Date and time the comment was posted.

user:

type: object

properties:
userId:

type: string

description: Unique identifier for the user.

name:

type: string

description: Name of the user.

profilePicture:

type: string

format: uri

description: URI for the user's profile picture.

'400':

description: Bad request

content:

application/json:

schema:

type: object

properties:

error:

type: string

'404':

description: Article not found

content:

application/json:

schema:

type: object

properties:

error:

type: string
components:

securitySchemes:

ApiKeyAuth:

type: apiKey

in: header

name: X-API-KEY

security:

- ApiKeyAuth: []

You might also like