OpenFolia

Upload a branding image

POST
/branding/images

A logo, the mark or an icon, for PATCH /branding to name by its reference (sha256:<hash>); it shows nowhere until then. Send it as multipart/form-data with one file part named file and nothing else, with X-Ccms-Request. The type comes from the bytes: PNG or WebP. SVG is refused, not sanitised (an SVG can carry scripts and references; export the logo as PNG), as is anything else: 422 unsupported-image-type (meta.accepted). At most 1048576 bytes (422 too-large, meta.max, reading stops there) and 4096 pixels a side (422 image-too-large), and one still picture: an animated PNG or WebP is 422 animated-image, and a file that is not a well-formed PNG or WebP up to its end 422 unsupported-image-type. At most 200 images in use or uploaded within a day (409 too-many-uploads): an unused one is removed a day after its upload, or at once with DELETE /branding/images/{hash}. Counted towards the storage limit as content files are (CCMS_STORAGE_LIMIT_BYTES): past it 409 storage-limit-reached (meta.limit), nothing kept, audited as storage.upload-refused. Recorded with a branding.image-upload audit event; the same image again is 200 with the first upload, and nothing new is stored or audited. Needs the admin.branding permission.

Authorization

bearer
headerAuthorizationBearer <JWT>

A service account's token (ccms_sat_…, issued by POST /service-accounts/{id}/tokens), or, for local use and demo mode, the server's shared CCMS_API_TOKEN.

Header Parameters

X-Ccms-Request?string

Required (any non-empty value) with a body of type multipart/form-data: a cross-site form cannot send it. Not needed with application/vnd.api+json.

X-Ccms-User?string

Demo mode only (CCMS_AUTH_MODE=demo): the user ID to act as. The bearer token is still required; without demo mode the header is refused (400).

Request Body

multipart/form-data
  1. body
file*unknown

Response Body

This image was uploaded before: the first upload, unchanged.

application/vnd.api+json
  1. response
data*

id is the image’s SHA-256.

Example Request
curl -X POST 'http://localhost:3000/branding/images' \  -F 'file=null'
Example Response
{  "data": {    "type": "BrandingImage",    "id": "string",    "attributes": {      "reference": "string",      "contentType": "image/png",      "size": 1,      "width": 1,      "height": 1,      "uploadedAt": "2019-08-24T14:15:22Z"    }  }}