Store document

Table 1. Store document API
HTTP verb URL Request parameters
POST /cmod-rest/v1/document JSON request payload

The store document API uses information passed as a JSON request payload to store one or more documents to a Content Manager OnDemand server. While a request can contain more than one document, you can only store to a single application/application group combination at a time.

The request payload consists of the following parameters formatted as JSON. See the Sample request following the table for an example.

Table 2. Request payload parameters for store document API
Parameter name Type Description
applicationGroupName string Content Manager OnDemand application group name.
applicationName string Content Manager OnDemand application name.
documents array Array of document objects.
fileName string Name associated with the document to be stored. This parameter is optional.
pages number Number of pages in the document. This parameter is optional.
fieldList array Array of application group field objects.
fieldName string Application group field name.
fieldValue string Application group field value to store.
base64bytes string String of base64 encoded bytes that represent the document data.

Sample request

POST /cmod-rest/v1/document HTTP/1.1
usi-date: 2023-11-13T18:32:22Z
Authorization: CMODSharedKey odvttstl01-68yXERhn79KNry/oV7IY:6sD6qZt3FVIfP3p2L/uhnzLIIbpedU0sroAF8Whv304=
Content-Type: application/json
Host: localhost
Content-Length: 7945
            
{
  "applicationGroupName" : "LedgerTextReports",
  "applicationName" : "LedgerTextReports",
  "documents" : [ {
    "fileName" : "MonthEnd.txt",
    "pages" : 0,
    "fieldList" : [ {
      "fieldName" : "accountName",
      "fieldValue" : "Baxter Bay"
    }, {
      "fieldName" : "accountNum",
      "fieldValue" : "123456789"
    }, {
      "fieldName" : "rptDate",
      "fieldValue" : "2020-02-03"
    }, {
      "fieldName" : "fileName",
      "fieldValue" : "MonthEnd.txt"
    } ],
    "base64bytes" : "QkFYVEVSIEJBWSBJTkZPUk1BVElPTiBTWVNURU0gICAgICAgICAgICAgVFJBTl
NBQ1RJT04gREFURSA6MTUvMDcvMjAyMCAgICAgICAgICAgICAgICAgICAJCQkgIFBST0NFU1NJTkcgREFUR
SAwMS8wOC8yMDIwDQogTVpTQjMyLzMgICAgTElTVElORyBPRiBDSVMgRU5RVUlSWSBUUkFOU0FDVElPTlMg
...  (some data is omitted to save space) 
FICAgICBQUk9EVUNUIFJFRkVSRU5DRSAgICAgICAgICAgICAgIEJPVCAgICBUSU1FICAgICBVU0VSIElEIC
RJT04NCiAgICAwMDIwICAgICAgICAgIDQwMjAwMjAwMzQzICAgICAgICAgICAgICAgICAgICAgMTAwNiAgM
TI6NTQgUzEgICAgUFJPRFVDVCBJTkZPUk1BVElPTg0K"            
  } ]
}

The response from the store document API provides confirmation of all application group field values that were stored with the document as well as status for each document and status for the entire store request.

Sample response

HTTP/1.1 200 OK
X-Powered-By: Servlet/4.0
Content-Type: application/json
Date: Mon, 13 Nov 2023 18:32:23 GMT
Correlation-Id: f6f536f4-6d23-4513-88c7-8d9e9520367b
Content-Language: en-US
Content-Length: 567
            
{
  "applicationGroupName" : "LedgerTextReports",
  "applicationName" : "LedgerTextReports",
  "documents" : [ {
    "fieldList" : [ {
      "fieldName" : "accountName",
      "fieldValue" : "Baxter Bay"
    }, {
      "fieldName" : "accountNum",
      "fieldValue" : "123456789"
    }, {
      "fieldName" : "rptDate",
      "fieldValue" : "2020-02-03"
    }, {
      "fieldName" : "fileName",
      "fieldValue" : "MonthEnd.txt"
    } ],
    "fileName" : "MonthEnd.txt",
    "pages" : 0,
    "status" : "Loaded"
  } ],
  "status" : "Success"
}