Create node from C#
Hello. Hope someone can point me in the right direction here.
Using Content Server 16.2 API, trying to create a node using the following code:
using (var htc = new HttpClient()) { htc.DefaultRequestHeaders.Add("OTCSTICKET", GetOTAuthHeader()); MultipartFormDataContent MFDC = new MultipartFormDataContent(); MFDC.Add(new StringContent("144"), "type"); MFDC.Add(new StringContent("102417"), "parent_id"); MFDC.Add(new StringContent("testfromcsharp"), "name"); byte[] bb = ct.Files[0].File; ByteArrayContent file = new ByteArrayContent(bb); MFDC.Add(file); var response = htc.PostAsync(ConfigurationManager.AppSettings["OTBaseUrl"] + "/api/v2/nodes", MFDC).Result; }
I'm getting a pretty vague 500 response:
{StatusCode: 500, ReasonPhrase: 'Internal server error', Version: 1.1,
Content: System.Net.Http.StreamContent, Headers: { Date: Tue, 09 Oct
2018 21:28:13 GMT Server: Microsoft-IIS/10.0 X-Powered-By: ASP.NET
Content-Length: 230 Content-Type: text/html }}
Is my call correct? Anything missing?
Tagged:
0
Comments
-
Hi Peter, I have the same issue and the same error, in addition on the thread.log I get this:
"INFO Dispatcher error: Could not process object, invalid action 'create'"Is there anyone that can provide us a working C# example ?
1
Categories
- All Categories
- 108 Developer Announcements
- 53 Articles
- 106 General Questions
- 145 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 899 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 120 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management