POST /content/{path}

Adds a single file of new content to the platform, or adds a new directory.

Note: When creating or uploading content files, you can use the POST /content/{path} operation (with multipart/form-data content type) to upload a single file, or multiple files in a ZIP. You can use the POST /content/{path} operation (with application/x-www-form-urlencoded content-type) to create a new folder with a default JSON table of contents file in it, as in the example below, or to create a new file. If you are creating a new file, it cannot be empty; you must include the file contents in the payload, and must use the application/x-www-form-urlencoded content type.

Authorization Roles/Permissions: Must be logged in. API Admin or other authorized user.

This topic includes the following sections:

HTTP Method


Back to top



Back to top

Sample Request

Request URL #1

The example below creates a new folder named assets with a file in it, named toc.apiversion20693.acmepaymentscorp.json, the JSON table of contents file for the new folder. The file contains a single pair of curly braces (encoded in the sample request body below).

Request URL #2: API Legal Agreement

The example below uploads a new legal agreement for an API, with very simple text.

Request URL #3: Adding a SimpleDev documentation folder

The example below creates the documentation folder for a corresponding SimpleDev theme.

Sample request headers

POST /content/api/api18969.acmepaymentscorp/documents/assets/toc.apiversion20693.acmepaymentscorp.json HTTP/1.1
Host: {hostname}
Accept: */*
Content-Type: application/x-www-form-urlencoded; charset=UTF-8

Sample request body (request URL #1)


Sample request #3 in Postman

The example below creates the help folder for a corresponding SimpleDev theme, in Postman. In this example, CSRF is turned off, so only the content-type header is required. The path path parameter and folder form parameters are used.

Content Upload in Postman: URL, uploaded ZIP file, successful result

Back to top

Request Headers

For general information on request header values, refer to HTTP Request Headers.

Header Description
Accept Not applicable.
Content-Type application/x-www-form-urlencoded
X-Csrf-Token_{fedmemberID} The CSRF prevention header; may or may not be required, depending on platform settings. See CSRF Prevention on the Platform. By default, the CSRF header is not required for GET operations and is required for all others, with a few exceptions relating to user login.

Back to top

Request Parameters

Parameter Parm Type Data Type Required Description
body Form string Required The contents for the new file, URL-encoded. For example, for an empty JSON table of contents file in a new empty directory, this parameter would be body=%7B%7D which adds an empty set of curly braces for the empty JSON file.
type Form string Optional The type of content. Use a valid media type as a value for this attribute; for example, html or json. If not specified, the operation uses the file extension to determine the media type.
path Path string Required The path and filename for the location where you want to store the new content that you're adding. The path must be valid for your API resources. You choose the filename in the same way that you would when creating a file in your local file system.
folder Form Boolean Optional Indicates whether the operation is adding a folder. Default: false.

Back to top


If successful, this operation returns HTTP status code 200.

Back to top

Sample Response

The sample response below shows successful completion of this operation.

Sample response headers

HTTP/1.1 200 OK
Content-Type: text/html
Date: Tue, 1 Jul 2014 20:00:00 GMT

Sample response body

None. However, note that if you are running the API in a browser the HTTP code is returned in an HTML wrapper. For more information, see File Upload with Ajax.

Back to top

Response Headers

For general information on response header values, refer to HTTP Response Headers.

Header Description
Content-Type text/html

Back to top

Response Body

Name Type Description
Response String The response code, wrapped in HTML.

Back to top

Error Codes/Messages

If the call is unsuccessful an error code/message is returned. One or more examples of possible errors for this operation are shown below.

Item Value
401 Unauthorized. For example, you would get this response if you didn't include the custom X-Csrf-Token_{fedmemberID} header in the request, when it was required by the platform settings; or if you included an invalid or expired value for this header. You would also get this response for any operation that requires login (almost all) if the login cookie was missing.
500 An error occurred processing the call.

More information about Akana API Platform API error messages.

Back to top

Related Topics