3. Upload a Layer

This mechanism can only be used to update an existing layer. This version of the protocol does not allow for new layers to be created via the interface. The S2 application will provide some mechanism, probably human-oriented, to do this.

Uploading is done via an HTTP PUT request. The URL is the same used to retrieve the given layer.

PUT /interface/s2/1 HTTP/1.1
Host: www.livejournal.com
Content-Length: 65
Content-Type: application/x-danga-s2-layer

layerinfo "type" = "layout";
layerinfo "name" = "Upload Example";
...

If the given layer is an acceptable replacement for the layer indicated, the server will respond with either 201 Created, which means that the layer is accepted and has been updated on the system, or 202 Accepted, indicating that the layer was acceptable but the system will not instantly replace the existing layer with it for reasons unspecified.

The server can also respond with any HTTP error code. The code 500 is used to indicate that the server is unable to accept the layer. If this is due to a layer compile error, the error will be given in the optional part of the error response after the short and long error descriptions.

Optional Client Features

A client with access to a local S2 compiler may wish to perform a syntax check on the layer to be uploaded first. An option to override this should be provided to allow for future changes to S2 syntax which may cause parse errors in older versions of the compiler.

It is not advisable for the local client to attempt the checker phase of compilation, as this is slow and local copies of parent layers will frequently become out of date with that on the server.