Files
webarchive/api/openapi.yaml

254 lines
5.7 KiB
YAML

openapi: 3.1.0
info:
title: Sample API
description: API description in Markdown.
version: 1.0.0
servers:
- url: 'https://api.example.com/api/v1'
paths:
/pages:
get:
operationId: getPages
summary: Get all pages
responses:
200:
description: All pages data
content:
application/json:
schema:
$ref: '#/components/schemas/pages'
default:
$ref: '#/components/responses/undefinedError'
post:
operationId: addPage
summary: Add new page
parameters:
- in: query
name: url
schema:
type: string
- in: query
name: description
schema:
type: string
- in: query
name: formats
style: form
explode: false
schema:
type: array
items:
$ref: '#/components/schemas/format'
requestBody:
content:
application/json:
schema:
type: object
properties:
url:
type: string
description:
type: string
formats:
type: array
items:
$ref: '#/components/schemas/format'
required:
- url
responses:
201:
description: Page added
content:
application/json:
schema:
$ref: '#/components/schemas/page'
400:
description: Bad request
content:
application/json:
schema:
type: object
properties:
field:
type: string
nullable: false
error:
type: string
nullable: false
required:
- error
- field
default:
$ref: '#/components/responses/undefinedError'
/pages/{id}:
parameters:
- in: path
name: id
required: true
schema:
type: string
format: uuid
get:
operationId: getPage
description: Get page details
responses:
200:
description: Page data
content:
application/json:
schema:
$ref: '#/components/schemas/pageWithResults'
404:
description: Page not found
default:
$ref: '#/components/responses/undefinedError'
/pages/{id}/file/{file_id}:
parameters:
- in: path
name: id
required: true
schema:
type: string
format: uuid
- in: path
name: file_id
required: true
schema:
type: string
format: uuid
get:
operationId: getFile
description: Get file content
responses:
200:
description: File content
content:
application/pdf: { }
text/plain:
schema:
type: string
text/html:
schema:
type: string
404:
description: Page of file not found
default:
$ref: '#/components/responses/undefinedError'
components:
responses:
undefinedError:
description: Undefined Error
content:
application/json:
schema:
$ref: '#/components/schemas/error'
schemas:
format:
type: string
enum:
- all
- pdf
- single_file
- headers
error:
type: object
properties:
message:
type: string
localized:
type: string
required:
- message
pages:
type: array
items:
$ref: '#/components/schemas/page'
page:
type: object
properties:
id:
type: string
format: uuid
url:
type: string
created:
type: string
format: date-time
formats:
type: array
items:
$ref: '#/components/schemas/format'
status:
$ref: '#/components/schemas/status'
meta:
type: object
properties:
title:
type: string
description:
type: string
error:
type: string
required:
- title
- description
required:
- id
- url
- formats
- status
- created
- meta
result:
type: object
properties:
format:
$ref: '#/components/schemas/format'
error:
type: string
files:
type: array
items:
type: object
properties:
id:
type: string
format: uuid
name:
type: string
mimetype:
type: string
size:
type: integer
format: int64
required:
- id
- name
- mimetype
- size
required:
- format
- files
pageWithResults:
allOf:
- $ref: '#/components/schemas/page'
- type: object
properties:
results:
type: array
items:
$ref: '#/components/schemas/result'
required:
- results
status:
type: string
enum:
- new
- processing
- done
- failed
- with_errors