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-12-03 11:52:09

Andrei_Grosu
Member
Registered: 2014-06-30
Posts: 8

Upload metadata for multiple files

Is there a method to upload metadata for multiple files? I am using at the moment Files_UpdateMetadata for each ims file reference which uploads one at a time.

Offline

#2 2014-12-05 12:36:26

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

Re: Upload metadata for multiple files

Hi Andrei,

Files.SetMetadata accepts an array for $assetId - in this case the $values hashes for each file should be provided as a hash keyed by IMS file reference.

Dominic

Offline

#3 2016-04-25 14:19:19

angela
Member
Registered: 2016-04-25
Posts: 3

Re: Upload metadata for multiple files

Could you please help us with Syntax to Set Meta data for multiple files using Files.SetMetaData, I am getting Input error

Offline

#4 2016-04-25 14:49:01

ben
Third Light Staff
From: Third Light
Registered: 2013-06-06
Posts: 66

Re: Upload metadata for multiple files

Hi Angela,
I see our docs for Files.SetMetadata() are not very clear, but under the hood that method calls straight through into Metadata.SetMetadata() which has some more comprehensive documentation.

An example call with Files.SetMetadata would look like:

Files.SetMetadata({
	"assetId":"123123123",
	"values":{
		"keywords":[
			{
				"value":"blue sky",
				"inherit":false,
				"override":false
			},
			{
				"value":"clouds",
				"inherit":false,
				"override":false
			}
		],
		"caption":[
			{
				"value":"Scenery at midday",
				"inherit":false,
				"override":false
			}
		],
		"copyright":[
			{
				"value":"Photograph Copyright Jo Bloggs 2016",
				"inherit":false,
				"override":true
			}
		],
		"exifcreationdate":[
			{
				"value":1394298395,
				"inherit":false,
				"override":false
			}
		]
	}
})

One important thing to note is that each entry in the "values" hash must be an array even when the metadata field doesn't support multiple values. e.g. Caption - as above this is specified as an array with one item.

Hope this helps,
Ben

Offline

#5 2016-04-25 14:58:38

ben
Third Light Staff
From: Third Light
Registered: 2013-06-06
Posts: 66

Re: Upload metadata for multiple files

Further to the above, this would be an example call when setting multiple files in one go:

Files.SetMetadata({
	"assetId":["123","456"],
	"values":{
		"123": {
			"caption":[
				{
					"value":"First Caption",
					"inherit":false,
					"override":false
				}
			],
		},
		"456": {
			"caption":[
				{
					"value":"Second Caption",
					"inherit":false,
					"override":false
				}
			],
		}
	}
})

Ben

Offline

#6 2016-04-25 16:10:35

angela
Member
Registered: 2016-04-25
Posts: 3

Re: Upload metadata for multiple files

Thanks you very much.. the above example has resolved the issue

Offline

Board footer