bfile/resource/api_ref.swagger.yml

93 lines
2.7 KiB
YAML

openapi: 3.0.3
info:
title: ResourceD API
description: |-
This is the ResourceD API docs.
license:
name: GPLv3
url: https://www.gnu.org/licenses/gpl-3.0.en.html
version: "1.0"
servers:
- url: http://localhost/resource
tags:
- name: Data API
description: API for serving data
- name: System API
description: API for serving system data
- name: Internal API
description: API for microservices. Shouldn't be accessible via WAN
paths:
/{id}:
get:
description: Get a resource
summary: Get a resource. Send browser requests to this URL
tags:
- Data API
responses:
200:
description: Returns a resource in its binary data
302:
description: Resource is an external (http) link and the redirect is being forwarded to that link
404:
description: Not found
500:
description: Internal error
/info/is_enabled:
get:
description: Check if resourceD is enabled
summary: Check if resourceD is enabled
tags:
- System API
responses:
200:
description: Ok
content:
application/json:
schema:
type: boolean
example: true
/internal/check_resource:
post:
summary: Check if a resource(s) exist
description: |-
This method takes an array of resources and reports which ones exist.
See responses for more info.
tags:
- Internal API
requestBody:
description: |-
An array of strings, where each string is a resource ID
Let's assume that we want to check if two resources exist: `dev.blek.file.logo` and `org.nonexistant.resource`.
content:
application/json:
schema:
type: array
items:
type: string
example:
- dev.blek.file.logo
- org.nonexistant.resource
responses:
200:
description: |-
As in the request body example, let's assume that this method checked if these two resources exist:
- `dev.blek.file.logo`
- `org.nonexistant.resource`
As we can see, this returned only `dev.blek.file.logo` because its the only resource of the provided ones that exist.
content:
application/json:
schema:
type: object
additionalProperties:
type: object
properties:
type:
type: string
example:
dev.blek.file.logo:
type: image/png