Documents API

The Document API supports the process of uploading and editing documents. These documents can be embedded in the post using shortcodes.

Supported Document

By default, the following file types are supported by this API:

Type

Mime

CSV

text/csv

DOC

application/vnd.openxmlformats-officedocument.wordprocessingml.document

DOCX

application/vnd.openxmlformats-officedocument.wordprocessingml.document

JSON

application/json

PDF

application/pdf

PPT

application/vnd.openxmlformats-officedocument.presentationml.presentation

PPTX

application/vnd.openxmlformats-officedocument.presentationml.presentation

SRT

text/plain

XLS

application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

XLSX

application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

ZIP

application/zip

Uploading documents

Upload a document and send its contents as a part of an HTTP request body.

POST /api/1.3/documents

Note

  • Multiple files can be sent as part of an HTTP request.

  • For requests with “multipart/form-data” content type, files should be named with “file”.

Example with multipart/form-data

POST /api/1.3/documents HTTP/1.1
HOST: <domain>
x-rmauth: <api key>
authorization: Basic <base64 encoded credentials>
content-type: multipart/form-data; boundary=----WebKitFormBoundarym59pe8dwmBaESksR
content-length: <content length>

------WebKitFormBoundarym59pe8dwmBaESksR
Content-Disposition: form-data; name="file"; filename="document.pdf"
Content-Type: application/pdf

<file content>
------WebKitFormBoundarym59pe8dwmBaESksR--

Response

For a single document:

{
      "shortcode_params": {
          "site_id": 123456,
          "original_filename": "document.pdf"
      },
      "file_original_url": "https://roar-assets-auto.rbl.ms/documents/123/document.pdf",
      "media_html": "<a href=\"https://roar-assets-auto.rbl.ms/documents/123/document.pdf\" class=\"rm-shortcode\" data-rm-shortcode-id=\"f538698f8aa1739b0e1ef36c77a567df\">document.pdf</a>",
      "original_filename": "document.pdf",
      "shortcode_id": "f538698f8aa1739b0e1ef3",
      "shortcode": "[rebelmouse-document-pdf 123 site_id=123456 original_filename=\"document.pdf\"]",
      "id": 12345,
      "filename": "document.pdf"
  },

For multiple documents:

The documents will all use the same schema and will be returned in the form of an array.

Editing documents

Editing a document (in terms of changing file content).

Same as uploading, file contents are sent as a part of an HTTP request body.

PUT /api/1.3/documents/<id>

Response

The response here is the same as when document are uploaded. Only one document can be edited per request.