I am at present writing some tests for Azure Experience Manager ,in which i need to upload huge data like jpg , Tiff ,Zip .. etc files.
So To add that I am using Api POST call using my C# Test Project in visual Studio .
I am using Http Client with HttpContent as MultipartFormDataContent , so it adds the Asset inside my Custom Folder in CRXDE Lite
the Url is Like this "http://localhost:4502/crx/de/index.jsp#/content/dam/AemTest ".
But the Structure it shows is, it add a FileContent e.g abc.jpg and child Node it adds jcr:content where some metadata appears . Inside Tool-> CRXDE lite
Note : jcr:primaryType = nt:file
But when Looked inside Assets Folder , it shows Empty . i.e Navigation->Asset-> Files->AemTest
Now when I am Tring to add Manually the Same Asset
it shows an Asset added as jcr:primaryType = dam:Asset inside CRXDE Lite
also the Structure it comes as first it creates a Node Named eg. "abc.jpg" then in child Node jcr:content then child node metadata, rendition folder, related node
How can I achieve this by using Api calls like POST,GET ,PUT .
Views
Replies
Total Likes
Please refer to this document that describes the Asset HTTP API -- Assets HTTP API
Referring to document , Now I am Trying to Update the Metadata for a Asset e.g bird.jpg
So Below is the Code I am Referring to
HttpWebRequest httpWReq = (HttpWebRequest)WebRequest.Create(http://localhost:4502/content/AemTest/bird.jpg);
NetworkCredential nc = new NetworkCredential("admin", "admin");
httpWReq.Method = "PUT";
httpWReq.Credentials = nc;
httpWReq.ContentType = "application/json";
String postData = "{\"class\":\"asset\", \"properties\":{\"dc:title\":\"My Asset\"}}";
using (var streamWriter = new StreamWriter(httpWReq.GetRequestStream()))
{
streamWriter.Write(postData);
streamWriter.Flush();
streamWriter.Close();
}
HttpWebResponse response = (HttpWebResponse)httpWReq.GetResponse();
But everytime it returns "NO CONTENT". and the Asset is not getting updated .
Views
Replies
Total Likes