Add media API and split API docs in two menu items

This commit is contained in:
Eugen Rochko 2018-10-05 02:35:29 +02:00
parent f028cfde91
commit 8258abd6ea
13 changed files with 69 additions and 25 deletions

View File

@ -31,7 +31,12 @@ enableGitInfo = true
identifier = "development" identifier = "development"
url = "/development/" url = "/development/"
[[menu.docs]] [[menu.docs]]
name = "API" name = "API Overview"
weight = 4 weight = 4
identifier = "api" identifier = "api"
url = "/api/" url = "/api/"
[[menu.docs]]
name = "REST API"
weight = 5
identifier = "rest-api"
url = "/api/rest/"

View File

@ -1,8 +1,8 @@
--- ---
title: Apps API title: Apps
menu: menu:
docs: docs:
parent: api parent: rest-api
weight: 10 weight: 10
--- ---

View File

@ -1,8 +1,8 @@
--- ---
title: Blocks API title: Blocks
menu: menu:
docs: docs:
parent: api parent: rest-api
weight: 10 weight: 10
--- ---

View File

@ -1,8 +1,8 @@
--- ---
title: Custom emoji API title: Custom emoji
menu: menu:
docs: docs:
parent: api parent: rest-api
weight: 10 weight: 10
--- ---

View File

@ -1,8 +1,8 @@
--- ---
title: Endorsements API title: Endorsements
menu: menu:
docs: docs:
parent: api parent: rest-api
weight: 10 weight: 10
--- ---

View File

@ -1,8 +1,8 @@
--- ---
title: Favourites API title: Favourites
menu: menu:
docs: docs:
parent: api parent: rest-api
weight: 10 weight: 10
--- ---

View File

@ -1,8 +1,8 @@
--- ---
title: Follow suggestions API title: Follow suggestions
menu: menu:
docs: docs:
parent: api parent: rest-api
weight: 10 weight: 10
--- ---

View File

@ -1,8 +1,8 @@
--- ---
title: Instances API title: Instances
menu: menu:
docs: docs:
parent: api parent: rest-api
weight: 10 weight: 10
--- ---

View File

@ -1,7 +1,46 @@
--- ---
title: Media attachments API title: Media attachments
menu: menu:
docs: docs:
parent: api parent: rest-api
weight: 10 weight: 10
--- ---
## POST /api/v1/media
Upload a media attachment that can be used with a new status.
Returns [Attachment]({{< relref "entities.md#attachment" >}})
### Resource information
{{< api_method_info auth="Yes" user="Yes" scope="write write:media" version="0.0.0" >}}
### Parameters
|Name|Description|Required|Default|
|----|-----------|:------:|:-----:|
| `file` | Media to be uploaded (encoded using `multipart/form-data`) | Required ||
| `description` | A plain-text description of the media for accessibility (max 420 chars) | Optional ||
| `focus` | Two floating points, comma-delimited. See [focal points](#focal-points) | Optional ||
## PUT /api/v1/media/:id
Update a media attachment. Can only be done before the media is attached to a status.
Returns [Attachment]({{< relref "entities.md#attachment" >}})
### Resource information
{{< api_method_info auth="Yes" user="Yes" scope="write write:media" version="0.0.0" >}}
### Parameters
|Name|Description|Required|Default|
|----|-----------|:------:|:-----:|
| `description` | A plain-text description of the media for accessibility (max 420 chars) | Optional ||
| `focus` | Two floating points, comma-delimited. See [focal points](#focal-points) | Optional ||
## Focal points
Server-side preview images are never cropped, to support a variety of apps and user interfaces. Therefore, the cropping must be done by those apps. To crop intelligently, focal points can be used to ensure a certain section of the image is always within the cropped viewport. [See this for how to let users select focal point coordinates](https://github.com/jonom/jquery-focuspoint#1-calculate-your-images-focus-point).

View File

@ -1,8 +1,8 @@
--- ---
title: Mutes API title: Mutes
menu: menu:
docs: docs:
parent: api parent: rest-api
weight: 10 weight: 10
--- ---

View File

@ -1,8 +1,8 @@
--- ---
title: Reports API title: Reports
menu: menu:
docs: docs:
parent: api parent: rest-api
weight: 10 weight: 10
--- ---

View File

@ -1,8 +1,8 @@
--- ---
title: Search API title: Search
menu: menu:
docs: docs:
parent: api parent: rest-api
weight: 10 weight: 10
--- ---

View File

@ -1,8 +1,8 @@
--- ---
title: Timelines API title: Timelines
menu: menu:
docs: docs:
parent: api parent: rest-api
weight: 10 weight: 10
--- ---