Articles
Store an image for an article
Stores an image for this article and answers with the URL it is served at, so whatever writes the article never needs somewhere of its own to host one. Needs content: write.
Two ways in, chosen by the body:
- source_url: Commune downloads the image and stores a copy. For an image you hold as a link, including a generated one on a link that will expire. It has to be a public http or https URL on the standard port; private and local network addresses are refused, redirects included.
- content_type: Commune answers with a one-time upload URL and the image's final url. PUT the file's bytes to upload.url with the upload.headers, before upload.expires_at. The bytes go straight to storage, so a file on disk never has to pass through a model or through this API. Until the upload is made, url answers 404.
Either way the image is a JPEG, PNG, WebP or GIF of at most 10MB, and the article itself is not changed: put the url in the body's Markdown () or in image_url with Update an article (PATCH /articles/{article}).
post/articles/{article}/images
Request
- Base URL: https://api.usecommune.com
- URL: https://api.usecommune.com/articles/{article}/images
- Auth: one of:
- HTTP bearer
- OAuth 2 (authorization code, authorization URL https://usecommune.com/api/oauth/authorize, token URL https://usecommune.com/api/oauth/token, scopes: content:write)
Request body
Example request
{
"source_url": "https://example.com/chart.png"
}Response
The stored image, or for an upload, where it will be once the file is uploaded.
Changes
No recorded changes to this operation across all 1 revision of this API.