Third Light Developer Exchange

Code and templating community forum for developers and software integrators

You are not logged in.

Announcement

If you wish to join the Developer Exchange, please contact your account manager - this is to avoid unnecessary spam in the forums. Many thanks for your understanding.

#1 2014-11-27 17:19:16

satishd
Member
Registered: 2014-11-18
Posts: 40

Add multiple keywords into metadata field

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

#2 2014-11-27 17:47:05

dominic
Third Light Staff
Registered: 2013-06-06
Posts: 119

Re: Add multiple keywords into metadata field

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

#3 2014-12-18 14:36:28

satishd
Member
Registered: 2014-11-18
Posts: 40

Re: Add multiple keywords into metadata field

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

#4 2015-01-06 12:44:04

dominic
Third Light Staff
Registered: 2013-06-06
Posts: 119

Re: Add multiple keywords into metadata field

Hi Satish,

The "metadataTags" parameter needs to be specified as an array of tags - a string is not supported.

Dominic

Offline

#5 2015-02-10 18:29:13

satishd
Member
Registered: 2014-11-18
Posts: 40

Re: Add multiple keywords into metadata field

Thanks Dominic,

It is now resolved.

Satish

Offline

Board footer