This commit is contained in:
@@ -0,0 +1,240 @@
|
||||
basePath: /
|
||||
definitions:
|
||||
handlers.categoriesResponse:
|
||||
properties:
|
||||
categories:
|
||||
example:
|
||||
- documentary
|
||||
- news
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
type: object
|
||||
handlers.completeRequest:
|
||||
properties:
|
||||
categories:
|
||||
example:
|
||||
- documentary
|
||||
- news
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
description:
|
||||
example: A behind-the-scenes look at the evening bulletin.
|
||||
type: string
|
||||
fileName:
|
||||
example: interview-cut.mov
|
||||
type: string
|
||||
key:
|
||||
example: videos/a1b2c3d4e5f6.mov
|
||||
type: string
|
||||
tags:
|
||||
example: media, press, riyadh
|
||||
type: string
|
||||
title:
|
||||
example: Inside the Newsroom
|
||||
type: string
|
||||
type: object
|
||||
handlers.healthResponse:
|
||||
properties:
|
||||
status:
|
||||
example: ok
|
||||
type: string
|
||||
type: object
|
||||
handlers.presignRequest:
|
||||
properties:
|
||||
contentType:
|
||||
example: video/quicktime
|
||||
type: string
|
||||
fileName:
|
||||
example: interview-cut.mov
|
||||
type: string
|
||||
type: object
|
||||
handlers.presignResponse:
|
||||
properties:
|
||||
key:
|
||||
example: videos/a1b2c3d4e5f6.mov
|
||||
type: string
|
||||
uploadUrl:
|
||||
example: https://raw-uploads-bucket.s3.amazonaws.com/videos/a1b2....mov?X-Amz-Signature=...
|
||||
type: string
|
||||
type: object
|
||||
handlers.problemDetails:
|
||||
properties:
|
||||
detail:
|
||||
example: The 'title' field was absent or contained only whitespace. Every
|
||||
video needs a non-empty title.
|
||||
type: string
|
||||
status:
|
||||
example: 422
|
||||
type: integer
|
||||
title:
|
||||
example: Title is required.
|
||||
type: string
|
||||
type:
|
||||
example: about:blank
|
||||
type: string
|
||||
type: object
|
||||
handlers.videoResponse:
|
||||
properties:
|
||||
categories:
|
||||
example:
|
||||
- documentary
|
||||
- news
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
createdAt:
|
||||
type: string
|
||||
description:
|
||||
example: A behind-the-scenes look at the evening bulletin.
|
||||
type: string
|
||||
fileName:
|
||||
example: interview-cut.mov
|
||||
type: string
|
||||
id:
|
||||
example: 0199f3a1-7c2e-7b21-9f0d-1a2b3c4d5e6f
|
||||
type: string
|
||||
mediaConvertJobId:
|
||||
example: 1755300000000-abcdef
|
||||
type: string
|
||||
sizeBytes:
|
||||
example: 60
|
||||
type: integer
|
||||
status:
|
||||
example: processing
|
||||
type: string
|
||||
storageKey:
|
||||
example: videos/a1b2c3d4e5f6.mov
|
||||
type: string
|
||||
tags:
|
||||
example: media, press, riyadh
|
||||
type: string
|
||||
title:
|
||||
example: Inside the Newsroom
|
||||
type: string
|
||||
updatedAt:
|
||||
type: string
|
||||
type: object
|
||||
info:
|
||||
contact: {}
|
||||
description: 'JSON API for ingesting videos into the Thamanyah catalogue. Uploads
|
||||
are two-step: presign, PUT the file straight to S3, then register the video to
|
||||
queue transcoding.'
|
||||
title: Thamanyah CMS API
|
||||
version: "1.0"
|
||||
paths:
|
||||
/api/categories:
|
||||
get:
|
||||
description: Returns the fixed lookup set of categories a video can belong to.
|
||||
Values from this list are the only ones accepted in the `categories` field
|
||||
of POST /api/videos.
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/handlers.categoriesResponse'
|
||||
"500":
|
||||
description: Categories could not be read from the database
|
||||
schema:
|
||||
$ref: '#/definitions/handlers.problemDetails'
|
||||
summary: List video categories
|
||||
tags:
|
||||
- categories
|
||||
/api/videos:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Step 2 of the upload flow. Takes the storage key returned by POST
|
||||
/api/videos/presign — after the file has been PUT to the presigned URL — submits
|
||||
a MediaConvert transcoding job, and persists the video with its category links.
|
||||
The returned record has status "processing"; note that nothing currently updates
|
||||
that status once transcoding finishes.
|
||||
parameters:
|
||||
- description: Video metadata plus the storage key from the presign step. title
|
||||
and key are required; categories must be values from GET /api/categories.
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/handlers.completeRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
schema:
|
||||
$ref: '#/definitions/handlers.videoResponse'
|
||||
"400":
|
||||
description: Request body was not valid JSON
|
||||
schema:
|
||||
$ref: '#/definitions/handlers.problemDetails'
|
||||
"422":
|
||||
description: title was empty, or key was missing or not a key issued by
|
||||
this API
|
||||
schema:
|
||||
$ref: '#/definitions/handlers.problemDetails'
|
||||
"500":
|
||||
description: Transcoding job could not be queued, or the video record could
|
||||
not be saved
|
||||
schema:
|
||||
$ref: '#/definitions/handlers.problemDetails'
|
||||
summary: Register an uploaded video
|
||||
tags:
|
||||
- videos
|
||||
/api/videos/presign:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Step 1 of the upload flow. Returns a short-lived presigned S3 URL
|
||||
that the client PUTs the video file to directly, plus the storage key identifying
|
||||
it. Once the PUT succeeds, pass that same key to POST /api/videos to register
|
||||
the video and start transcoding. The file itself never passes through this
|
||||
API.
|
||||
parameters:
|
||||
- description: Name and media type of the file to be uploaded. contentType must
|
||||
be a video/* type.
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/handlers.presignRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/handlers.presignResponse'
|
||||
"400":
|
||||
description: Request body was not valid JSON
|
||||
schema:
|
||||
$ref: '#/definitions/handlers.problemDetails'
|
||||
"422":
|
||||
description: contentType was not a video/* media type
|
||||
schema:
|
||||
$ref: '#/definitions/handlers.problemDetails'
|
||||
"500":
|
||||
description: Upload URL could not be issued
|
||||
schema:
|
||||
$ref: '#/definitions/handlers.problemDetails'
|
||||
summary: Create a presigned upload URL
|
||||
tags:
|
||||
- videos
|
||||
/health:
|
||||
get:
|
||||
description: Reports that the service is up and serving. Used as the ALB target
|
||||
group health check; it does not verify the database or S3 connections.
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/handlers.healthResponse'
|
||||
summary: Health check
|
||||
tags:
|
||||
- system
|
||||
swagger: "2.0"
|
||||
Reference in New Issue
Block a user