You are not logged in.
Pages: 1
Hi There,
I am trying to add multiple keywords (tokens) into metadata field through the API but unable to do so, I tried adding newline char as well as Tab in the
key/value pair but it does not work, Could you please advise how this can be achieved.
NameValueCollection mvc = new NameValueCollection();
mvc.Add("file_caption", "TEST CITY");
mvc.Add("file_keywords", "LONDON\r\nManchester"); (also tried mvc.Add("file_keywords", "LONDON\tManchester");)
string formdataTemplate = "Content-Disposition: form-data; name=\"{0}\"\r\n\r\n{1}\r\n";
foreach (string key in nvc.Keys)
{
rs.Write(boundarybytes, 0, boundarybytes.Length);
string formitem = string.Format(formdataTemplate, key, nvc[key]);
byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem);
rs.Write(formitembytes, 0, formitembytes.Length);
}
Thanks
Satish
Offline
Hi Satish,
The way to do this would be to add multiple form fields, with [] appended to the name - e.g. file_keywords[] - however it doesn't look as if this is supported at present.
The alternative would be to get the IMS file reference created and use the regular metadata editing API calls to add metadata at that point.
Dominic
Offline
Hi,
I've resolved the metadata parameters issue, but unable to see the updated text in meta data- any idea why meta data didn't commit.
although response text is successful, please find the input and output text as below
Input string
"{\"action\":\"Files.UpdateMetadata\",\"apiVersion\":\"1.0\",\"sessionId\":\"r1zC4005mxi8CwStLmzK,5R8oJch53Vh\",\"inParams\":{\"assetId\": \"27007052902\",\"metadataTags\":\"keywords\",\"metadata\":{\"keywords\":[\"Modified by API\"]}}}"
output string:
"{\"result\":{\"api\":\"OK\",\"action\":\"OK\"},\"outParams\":{\"assetId\":\"27007052902\"}}"
Thanks
Satish
Last edited by satishd (2014-12-18 15:06:08)
Offline
Hi Satish,
The "metadataTags" parameter needs to be specified as an array of tags - a string is not supported.
Dominic
Offline
Thanks Dominic,
It is now resolved.
Satish
Offline
Pages: 1