Skip to main content
Upload bytes to session storage, creating or replacing a file session object.

POST /revisions/:id/data/command (Command: upload_session_file)

This is a binary command: the file bytes are the application/octet-stream request body, and the JSON command below is serialized onto a single line into the X-Request-Body header instead of the body. X-Request-Body is named in the API’s Access-Control-Allow-Headers, so a browser client can send it.

Request Body

Serialized into X-Request-Body, not into the body itself: The alias must conform to the session-object alias grammar: one or more /-separated segments of AZ, az, 09, ., _, -, @; 1–256 characters total; no segment may be . or ... An alias outside the grammar returns 400 invalid_session_object_alias. A successful upload fires a session_object_modified session event.

Response

Unlike upload_session_object, this command returns the created object’s full envelope, since the server computes size and sha256 from the bytes it received:

Errors

  • unsupported_file_typecontent_type (after dropping parameters and lower-casing) does not match any entry in the content-type allow-list.
  • session_file_too_large — the uploaded bytes exceed the 4 MiB limit.
  • session_file_size_mismatch — the declared size does not match the number of bytes actually received.
  • invalid_file_object — the alias already names a session object that exists and is not a file.

Example

See also