Creating multiple objects in Documentum through Documentum Rest services.
Hi All,
We have a requirement to create a multiple documents through documentum rest services in single POST call .we are using below code to create a single document in repository.
public class RestClient{
public static void main(String args[]){
try{
System.out.println("In main");
RestClient rc = new RestClient();
rc.testRestClient();
}
catch(Exception ex){
System.out.println("exception is : "+ex.getMessage());
}
}
@SuppressWarnings("deprecation")
public void testRestClient() throws ClientProtocolException, IOException
{
String path = "http://SERVER/dctm-rest/repositories/REPOS/folders/OBJECT_ID/documents";
String auth = "Basic " + "*******";
String json = "{\"properties\" : {\"object_name\" : \"TEST\", \"r_object_type\" "dm_document\"}}";
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(path);
post.addHeader("Authorization", auth);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
MultipartEntityBuilder builder1 = MultipartEntityBuilder.create();
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
builder.addPart("data", new StringBody(json, "application/vnd.emc.documentum", Charset.forName("UTF-8")));
//builder.addBinaryBody("binary", byteArray, ContentType.create("application/pdf"), "test.pdf");
URL rest = new URL("http://Server:8080/dctm-rest/repositories/REPOS/objects/OBJECT_ID/content-media?format=pdf&modifier=&page=0");
URLConnection uc = rest.openConnection();
uc.setRequestProperty("Authorization", "Basic " + "************");
InputStream content = uc.getInputStream();
builder.addBinaryBody("binary", content, ContentType.create("application/pdf"), "test.pdf");
HttpEntity entity = builder.build();
post.setEntity(entity);
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
HttpResponse response = httpClientBuilder.build().execute(post);
System.out.println("Respsone is "+response.toString());
}
}
Can you let me know is there any way to pass multiple create request in single HTTP POST call?
Thanks,
vivek.
Best Answer
-
Let me put all together.
- If you want to import multiple contents for different documents, it's recommended to use Batches Resource (REST 7.3+).
- If you want to import multiple contents for a single document, it's recommended to make multipart POST directly on Folder Child Objects Resource or Folder Child Documents Resource. (REST 7.3+)
Here is a Postman example for (2).
- At least specify parameters content-count, all-primary and format
- Select form-data format
- The 1st part is a JSON object containing properties
- The 2nd part and all following parts are contents, either from input texts or from files.
Content import in Batches Resource is supported in REST 7.3.
Multi content import for a single document is supported in REST 7.3.
0
Answers
-
-
https://community.emc.com/docs/DOC-42227 here I can see sample payload json request to create multiple documents in repository .
Is it possible to create multiple content by following this?
0 -
I have a little confusion with content and document referred here, My requirement is I need to import multiple documents like PDF or TEXT files into documentum in single POST call.
Can you please let me know ,Is this can be achieved through 7.2 ?,If possible can you guide us to the reference links or JSON requests can be used to achieve this.
0 -
Let me put all together.
- If you want to import multiple contents for different documents, it's recommended to use Batches Resource (REST 7.3+).
- If you want to import multiple contents for a single document, it's recommended to make multipart POST directly on Folder Child Objects Resource or Folder Child Documents Resource. (REST 7.3+)
Here is a Postman example for (2).
- At least specify parameters content-count, all-primary and format
- Select form-data format
- The 1st part is a JSON object containing properties
- The 2nd part and all following parts are contents, either from input texts or from files.
Content import in Batches Resource is supported in REST 7.3.
Multi content import for a single document is supported in REST 7.3.
0 -
Hi,
Are you able to get payload for the PDF or Text files.
Vinod Krishna
Architect, Consulting Services
OpenText0
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 152 General Questions
- 148 Thrust Services
- 57 Developer Hackathon
- 37 Thrust Studio
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 32 eDOCS
- 186 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 8 XM Fax
- Follow Categories