367 lines
7.1 KiB
JSON
367 lines
7.1 KiB
JSON
{
|
|
"openapi": "3.1.0",
|
|
"info": {
|
|
"title": "PrivateBin HTTP API",
|
|
"description": "wrapper server for privatebin API (create/read/delete) via query parameters",
|
|
"version": "1.0.0"
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "http://{host}:{port}",
|
|
"variables": {
|
|
"host": {
|
|
"default": "0.0.0.0"
|
|
},
|
|
"port": {
|
|
"default": "1331"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"paths": {
|
|
"/privatebin/create": {
|
|
"get": {
|
|
"operationId": "privatebinCreate",
|
|
"summary": "create a privatebin paste",
|
|
"parameters": [
|
|
{
|
|
"name": "base_url",
|
|
"in": "query",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"format": "uri"
|
|
},
|
|
"description": "root url of your privatebin instance, e.g. https://privatebin.example"
|
|
},
|
|
{
|
|
"name": "text",
|
|
"in": "query",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "plain text of the paste"
|
|
},
|
|
{
|
|
"name": "password",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "optional password to protect the paste"
|
|
},
|
|
{
|
|
"name": "expiration",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "string",
|
|
"enum": [
|
|
"5min",
|
|
"10min",
|
|
"1hour",
|
|
"1day",
|
|
"1week",
|
|
"1month",
|
|
"1year",
|
|
"never"
|
|
],
|
|
"default": "1day"
|
|
},
|
|
"description": "expire time"
|
|
},
|
|
{
|
|
"name": "formatting",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "string",
|
|
"enum": [
|
|
"plaintext",
|
|
"syntaxhighlighting",
|
|
"markdown"
|
|
],
|
|
"default": "plaintext"
|
|
},
|
|
"description": "one of plaintext, syntaxhighlighting, markdown"
|
|
},
|
|
{
|
|
"name": "burn_after_reading",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"description": "delete after first read"
|
|
},
|
|
{
|
|
"name": "discussion",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"description": "enable comments/discussion"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "paste created successfully",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/CreatePasteResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "invalid request parameters",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"502": {
|
|
"description": "upstream privatebin send failed",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/privatebin/read": {
|
|
"get": {
|
|
"operationId": "privatebinRead",
|
|
"summary": "read a privatebin paste",
|
|
"parameters": [
|
|
{
|
|
"name": "full_url",
|
|
"in": "query",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"format": "uri"
|
|
},
|
|
"description": "full url of the paste (including key fragment)"
|
|
},
|
|
{
|
|
"name": "password",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "password if the paste is protected"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "paste fetched successfully",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ReadPasteResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "missing full_url parameter",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"502": {
|
|
"description": "upstream privatebin get failed",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/privatebin/delete": {
|
|
"get": {
|
|
"operationId": "privatebinDelete",
|
|
"summary": "delete a privatebin paste",
|
|
"parameters": [
|
|
{
|
|
"name": "full_url",
|
|
"in": "query",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"format": "uri"
|
|
},
|
|
"description": "full url of the paste (including key fragment)"
|
|
},
|
|
{
|
|
"name": "deletetoken",
|
|
"in": "query",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"description": "deletetoken returned upon create"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "paste deleted successfully",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/DeletePasteResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "missing full_url or deletetoken",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"502": {
|
|
"description": "upstream privatebin delete failed",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"CreatePasteResponse": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"status": {
|
|
"type": "integer"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"url": {
|
|
"type": "string"
|
|
},
|
|
"full_url": {
|
|
"type": "string"
|
|
},
|
|
"deletetoken": {
|
|
"type": "string"
|
|
},
|
|
"passcode": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"status",
|
|
"id",
|
|
"url",
|
|
"full_url",
|
|
"deletetoken"
|
|
]
|
|
},
|
|
"ReadPasteResponse": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"status": {
|
|
"type": "integer"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"url": {
|
|
"type": "string"
|
|
},
|
|
"v": {
|
|
"type": "integer"
|
|
},
|
|
"text": {
|
|
"type": "string"
|
|
},
|
|
"meta": {
|
|
"type": "object",
|
|
"additionalProperties": true
|
|
},
|
|
"attachment": {
|
|
"type": "object",
|
|
"additionalProperties": true,
|
|
"description": "attachment object: includes filename and content (base64 or bytes)"
|
|
}
|
|
},
|
|
"required": [
|
|
"status",
|
|
"id",
|
|
"url",
|
|
"v"
|
|
]
|
|
},
|
|
"DeletePasteResponse": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"status": {
|
|
"type": "integer"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"url": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"status",
|
|
"id",
|
|
"url"
|
|
]
|
|
},
|
|
"Error": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"error": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"error"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
} |