Creating contents via REST
This document explains how to create new contents in a repository using Document.One (D1) REST API. You can create either a single content or a batch of contents in one go.
Log in to D1.
On the landing page, click the API link under repository where you want to create content(s):
The OpenAPI page opens, showing the available D1 endpoints. You have two options now — see Task 1: Creating a specific content and Task 2: Creating multiple contents.
Task 1: Creating a specific content
Find the
/access.adx.content.repository_name/v1/content
Create Content endpoint and expand it.To create folders, use the
/access.adx.content.demo/v1/folder
Create Folder endpoint.Attach the file to be a basis for your content in the resource field.
Optionally, change other properties as required.
Click Execute and check the response. A response with code
200
(success) means that the content is now created.Your content is now created and in
WORKING_COPY
status.
For a code sample, see
Create content
Setting custom type values on creating a content
In case a custom content is prepared it can on upload already set the according types. At the moment the OpenAPI user interface is not supporting custom types. Use curl
instead to do so. The properties needs to be sent as JSON as part of the properties
String-To-String map, for example:
curl -X POST "[http|https]://[HOST]:[PORT]/tribefire-services/api/v1/access.adx.content.[REPO_TECHNICAL_NAME]/v1/content?sessionId=[SESSION_ID]" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "serialized-request={\"properties\": { \"[PROPERTY_NAME]\": \"[PROPERTY_VALUE]\" } }" -F "resource=@[RESOURCE_NAME]" -F "entryType=[CUSTOM_TYPE]"
Imagine there exists a custom type called Invoice
and it has an invoiceNumber
, then use the following:
curl -X POST "[http|https]://[HOST]:[PORT]/tribefire-services/api/v1/access.adx.content.[REPO_TECHNICAL_NAME]/v1/content?sessionId=[SESSION_ID]" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "serialized-request={\"properties\": { \"invoiceNumber\": \"myInvoiceNumberValue\" } }" -F "resource=@myInvoice.pdf" -F "entryType=Invoice"
Task 2: Creating multiple contents
- Find the
/access.adx.content.repository_name/v1/contents
Create Contents endpoint and expand it. - Attach the files your contents should be created from in the resources field.
- Optionally, change other properties as required.
- Click Execute and check the response. A response with code
200
(success) means that the content is now created. - Your contents are now created and in
WORKING_COPY
status.
For a code sample, see