POST /content/{path}
Uploads a single file of existing content to the platform, or uploads a ZIP file of existing content and unzips it to the specified location.
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
POST
URL
https://{hostname}/content/{path}
Sample Request
The example below shows a request to upload a ZIP file of content for the specified API.
Request URL #1
Uploads an API documentation ZIP file and unzips it.
https://acmepaymentscorp.com/content/api/api19427.acmepaymentscorp/documents?unpack=true&wrapInHTML=true
Request URL #2
https://acmepaymentscorp.com/content/help?unpack=true
Sample request headers
POST /content/api/api19427.acmepaymentscorp/documents?unpack=true&wrapInHTML=true HTTP/1.1 Host: {hostname} Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 X-Csrf-Token_acmepaymentscorp: TokenID%3D8ed70a13-8469-11e8-b37a-b155e4eabeb8%2CexpirationTime%3D153...
Sample request body
The request body is the ZIP file.
Sample request #2 in Postman
In the example below, the content being uploaded is a ZIP file to be placed in the content/help folder for display in SimpleDev theme. The index.zip file is uploaded to the content/help folder and unzipped (unpack=true parameter).
Request URL #3: Adding a platform legal agreement
The example below uploads a platform legal agreement to the content/system/agreements folder.
http://acmepaymentscorp.com/content/system/agreements
Sample request headers
POST /content/system/agreements Host: {hostname} Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Content-Type: application/x-www-form-urlencoded X-Csrf-Token_acmepaymentscorp: TokenID%3D8ed70a13-8469-11e8-b37a-b155e4eabeb8%2CexpirationTime%3D153...
Sample request body (request URL #3)
The request body is the uploaded file. See Postman example below.
Sample request/response #3 in Postman
The example below uploads a platform legal agreement. The valid content path for a platform legal agreement is /content/system/agreements. The file is uploaded and the operation is successful. The response is an HTTP 200 with no content.
Request Headers
For general information on request header values, refer to HTTP Request Headers.
Header | Description |
---|---|
Accept | Not applicable. |
Content-Type |
In the form data, you must include a key of File; the value for the key is the individual file or ZIP file with the content you want to upload to the specified location, as shown above in Postman. If you're uploading a ZIP file, include the unpack=true query parameter. Refer to Sample Request #2 and Sample Request #3 above. |
Cookie | AtmoAuthToken_{fedmemberid}={cookie value, which usually starts with TokenID}—The platform cookie. This is the Akana API Platform authorization token, and must be sent with every API request that requires login. For more information and an example, see Session cookies. |
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. |
Request Parameters
Parameter | Parm Type | Data Type | Required | Description |
---|---|---|---|---|
path | Path | string | Required | The path to the location where the content being uploaded will be unzipped and stored. The path must be valid for your API resources. |
unpack | Query | boolean | Required | Indicates whether the content must be unzipped. For a ZIP file this parameter is requied and must be set to true. |
InMultiPart | Body | multipart | Required | The content being uploaded. For more information, see Managing Multipart/Form-Data Uploads. |
Note: For information about the wrapInHTML parameter shown in the sample request above, see File Upload with Ajax. This is only used if you are running the API in a browser context.
Response
If successful, this operation returns HTTP status code 200, wrapped in HTML.
Sample Response
The sample response below shows successful completion of this operation.
Sample response headers
HTTP/1.1 200 OK Content-Type: text/html Content-Encoding: gzip Date: Mon, 24 Jun 2013 19:22:21 GMT
Sample response body
<!DOCTYPE html> <html lang="en" status="200" statusText="success"> <head> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> <meta content="IE=edge" http-equiv="X-UA-Compatible"> <meta name="description" content="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris lacus elit, ornare eget luctus vel, porta id elit. Maecenas molestie, libero sit amet blandit faucibus, orci nisi aliquet nisi, id mollis mauris ipsum a enim. Morbi lacus velit, placerat sit amet luctus eget, pulvinar a massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi eleifend tincidunt pellentesque. Cras eu sapien massa, vitae rutrum sapien. Aenean id condimentum sem. Suspendisse tempor luctus ipsum, vel metus."> </head> <body status="200" statusText="success"> </body> </html>
Note: for information about the HTML wrapper shown in the sample response above, see File Upload with Ajax.
Response Headers
For general information on response header values, refer to HTTP Response Headers.
Header | Description |
---|---|
Content-Type | text/html |
Response Body
Name | Type | Description |
---|---|---|
Response | String | The response code, wrapped in HTML. |
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.