Skip to content

Instantly share code, notes, and snippets.

@emkll
Created January 14, 2019 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emkll/6c1704100db372371a99f90d3197db45 to your computer and use it in GitHub Desktop.
Save emkll/6c1704100db372371a99f90d3197db45 to your computer and use it in GitHub Desktop.
openapi: "3.0.0"
info:
version: 0.11.0
title: SecureDrop Journalist API
license:
name: AGPLv3
servers:
- url: http://127.0.0.1:8081/api/v1
paths:
/token:
post:
summary: Get API token to authenticate API requests to journalist interface
operationId: get_token
security: []
tags:
- Authentication
parameters:
- name: username
required: true
in: query
schema:
type:
string
- name: password
required: true
in: query
schema:
type:
string
- name: totp_code
required: true
in: query
schema:
type:
integer
responses:
200:
description: Returns an API key for the authenticated journalist
content:
application/json:
schema:
type: string
403:
description: Token authentication failed
/sources:
get:
summary: List all sources
operationId: get_all_sources
tags:
- Sources
parameters:
- name: api_token
in: header
description: API Token for authentication
required: true
schema:
type: string
responses:
200:
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/Sources"
403:
description: Token authentication failed
/sources/{source_uuid}:
get:
summary: Retrieve a single source
operationId: single_source
tags:
- Sources
parameters:
- name: api_token
in: header
description: API Token for authentication.
required: true
schema:
type: string
- name: source_uuid
in: path
required: true
description: The ID of the source to retrieve
schema:
type: string
responses:
200:
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/Source"
403:
description: Token authentication failed
404:
description: Source not found
delete:
summary: Delete a single source
operationId: delete_source
tags:
- Sources
parameters:
- name: api_token
in: header
description: API Token for authentication.
required: true
schema:
type: string
- name: source_uuid
in: path
required: true
description: The ID of the source to delete (and associated submissions)
schema:
type: string
responses:
200:
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/Source"
403:
description: Token authentication failed
404:
description: Source not found
/sources/{source_uuid}/add_star:
post:
summary: Star a source
operationId: make_star_true
tags:
- Sources
parameters:
- name: api_token
in: header
description: API Token for authentication
required: true
schema:
type: string
- name: source_uuid
in: path
required: true
description: The ID of the source to star
schema:
type: string
responses:
201:
description: Star added
403:
description: Token authentication failed
404:
description: Source not found
/sources/{source_uuid}/remove_star:
delete:
summary: Unstar a source
operationId: make_star_false
tags:
- Sources
parameters:
- name: api_token
in: header
description: API Token for authentication.
required: true
schema:
type: string
- name: source_uuid
in: path
required: true
description: The ID of the source to star
schema:
type: string
responses:
200:
description: Star added
403:
description: Token authentication failed.
404:
description: Source not found
/sources/{source_uuid}/flag:
post:
summary: Flag a source
operationId: flag
tags:
- Sources
parameters:
- name: api_token
in: header
description: API Token for authentication
required: true
schema:
type: string
- name: source_uuid
in: path
required: true
description: The ID of the source to flag
schema:
type: string
responses:
200:
description: Source flagged for reply
403:
description: Token authentication failed
404:
description: Source not found
/sources/{source_uuid}/submissions:
post:
summary: Download all submissions for source
operationId: all_source_submissions
tags:
- Submissions
parameters:
- name: api_token
in: header
description: API Token for authentication.
required: true
schema:
type: string
- name: source_uuid
in: path
required: true
description: The ID of the source on which to get submissions
schema:
type: string
responses:
200:
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/Submissions"
403:
description: Token authentication failed
404:
description: Source not found
/sources/{source_uuid}/submissions/{submission_uuid}/download:
get:
summary: Download a given submission for a source
operationId: download_submission
tags:
- Submissions
parameters:
- name: api_token
in: header
description: API Token for authentication.
required: true
schema:
type: string
- name: source_uuid
in: path
required: true
description: The ID of the source on which to get a given submission
schema:
type: string
- name: submission_uuid
in: path
required: true
description: The ID of the submission to download
schema:
type: string
responses:
200:
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/Submission"
403:
description: Token authentication failed
404:
description: Source or submission not found
/sources/{source_uuid}/submissions/{submission_uuid}:
get:
summary: Get a given submission for a source
operationId: single_submission
tags:
- Submissions
parameters:
- name: api_token
in: header
description: API Token for authentication.
required: true
schema:
type: string
- name: source_uuid
in: path
required: true
description: The ID of the source
schema:
type: string
- name: submission_uuid
in: path
required: true
description: The ID of the submission to get
schema:
type: string
responses:
200:
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/Submission"
403:
description: Token authentication failed
404:
description: Source or submission not found
delete:
summary: Delete a submission for a source
operationId: single_submission
tags:
- Submissions
parameters:
- name: api_token
in: header
description: API Token for authentication.
required: true
schema:
type: string
- name: source_uuid
in: path
required: true
description: The ID of the source
schema:
type: string
- name: submission_uuid
in: path
required: true
description: The ID of the submission to delete
schema:
type: string
responses:
200:
description: Submission deleted
403:
description: Token authentication failed
404:
description: Source or submission not found
/sources/{source_uuid}/replies:
get:
summary: Get replies for source
operationId: all_source_replies
tags:
- Replies
parameters:
- name: api_token
in: header
description: API Token for authentication.
required: true
schema:
type: string
- name: source_uuid
in: path
required: true
description: The ID of the source on which to get submissions.
schema:
type: string
responses:
201:
description: Your reply has been stored
content:
application/json:
schema:
$ref: "#/components/schemas/Replies"
403:
description: Token authentication failed
404:
description: Source not found
post:
summary: Reply to a source
operationId: all_source_replies
tags:
- Replies
parameters:
- name: api_token
in: header
description: API Token for authentication.
required: true
schema:
type: string
- name: source_uuid
in: path
required: true
description: The ID of the source to reply to
schema:
type: string
- name: reply
in: query
required: true
description: The journalist's reply to the source
schema:
type: string
responses:
200:
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/Replies"
400:
description: Invalid request
403:
description: Token authentication failed
404:
description: Source not found
/sources/{source_uuid}/replies/{reply_uuid}:
get:
summary: Get a single reply for a source
operationId: single_reply
tags:
- Replies
parameters:
- name: api_token
in: header
description: API Token for authentication.
required: true
schema:
type: string
- name: source_uuid
in: path
required: true
description: The ID of the source on which to get a given reply.
schema:
type: string
- name: reply_uuid
in: path
required: true
description: The ID of the reply to get
schema:
type: string
responses:
200:
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/Reply"
403:
description: Token authentication failed
404:
description: Source or submission not found
delete:
summary: Delete a submission for a source
operationId: single_submission
tags:
- Replies
parameters:
- name: api_token
in: header
description: API Token for authentication
required: true
schema:
type: string
- name: source_uuid
in: path
required: true
description: The ID of the source on which to get a given reply
schema:
type: string
- name: reply_uuid
in: path
required: true
description: The ID of the reply to delete
schema:
type: string
responses:
200:
description: Reply deleted
403:
description: Token authentication failed
404:
description: Source or submission not found
/submissions:
get:
summary: Get all submissions
operationId: get_all_submissions
tags:
- Submissions
parameters:
- name: api_token
in: header
description: API Token for authentication
required: true
schema:
type: string
responses:
200:
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/Submissions"
403:
description: Token authentication failed
/replies:
get:
summary: Get all replies
operationId: get_all_replies
tags:
- Replies
parameters:
- name: api_token
in: header
description: API Token for authentication
required: true
schema:
type: string
responses:
200:
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/Replies"
403:
description: Token authentication failed
/user:
get:
summary: Get current user
operationId: get_current_user
tags:
- Users
parameters:
- name: api_token
in: header
description: API Token for authentication
required: true
schema:
type: string
responses:
200:
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/Journalist"
403:
description: Token authentication failed
components:
schemas:
Source:
required:
- id
- uuid
- filesystem_id
- journalist_desigation
properties:
id:
type: integer
format: int64
uuid:
type: string
filesystem_id:
type: string
journalist_designation:
type: string
flagged:
type: string
last_updated:
type: object
star:
type: boolean
pending:
type: boolean
interaction_count:
type: integer
Submission:
required:
- id
- name
properties:
id:
type: integer
name:
type: string
tag:
type: string
Reply:
required:
- id
- uuid
- source_id
- source
- filename
- size
properties:
id:
type: integer
format: int64
uuid:
type: string
source_id:
type: string
source:
type: object
filename:
type: string
size:
type: integer
downloaded:
type: boolean
Journalist:
required:
- id
- uuid
- username
properties:
id:
type: integer
uuid:
type: string
username:
type: string
Sources:
type: array
items:
$ref: "#/components/schemas/Source"
Submissions:
type: array
items:
$ref: "#/components/schemas/Submission"
Replies:
type: array
items:
$ref: "#/components/schemas/Reply"
securitySchemes:
app_id:
type: apiKey
description: API key to authorize requests
name: api_token
in: header
security:
- api_token: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment