{"__v":3,"_id":"5480c92674904f1a00053c87","category":{"__v":5,"_id":"5480c8fd74904f1a00053c86","pages":["5480c92674904f1a00053c87","5480ccadb8caf31a00d771d6","5480ce6283bd5c080064289f","5480ceb383bd5c08006428a1","54ac0da8de18cc1400226de9"],"project":"54343170fa5527080064f449","version":"54343531bfaa3d0800c4d4af","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-12-04T20:50:05.267Z","from_sync":false,"order":9,"slug":"metadata","title":"Metadata"},"editedParams":true,"editedParams2":true,"parentDoc":null,"project":"54343170fa5527080064f449","user":"54343147fa5527080064f43f","version":{"__v":27,"_id":"54343531bfaa3d0800c4d4af","forked_from":"54343170fa5527080064f44c","project":"54343170fa5527080064f449","createdAt":"2014-10-07T18:47:13.086Z","releaseDate":"2014-10-07T18:47:13.086Z","categories":["54343531bfaa3d0800c4d4b0","543435b1edce040800409240","543435b9edce040800409241","543435bcedce040800409243","543435bfedce040800409244","543435c2edce040800409245","54370cc426469424002a6dfa","54370cf026469424002a6dfd","5437129d26469424002a6e2f","543712d226469424002a6e30","5480c8fd74904f1a00053c86","54aafc6eefb39016009e4d71","54ac1d36de18cc1400226e01","54ad59369219922100751732","54b41bcf4f25cb1600518d2c","54b533a3a806f40c0050d53c","54b54bbf96fe3c0b00d38d2a","54b688a27379a90c00f53a8a","54b699efbc1a46160005edfa","54b8191691011f0b00068804","54bfb002d03bfc0d0000e814","54bfb33ed03bfc0d0000e816","55a3e94e912a6e2300882cdb","55a56c370f354f0d00fd02a8","55e85ad034516037002e9325","5638ecb62fc5520d001a4cf9","572cba2fc310640e008f63d5"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"3.0.0","version":"3.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-12-04T20:50:46.276Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"basic_auth":false,"examples":{"codes":[{"name":"","code":"","language":"text"}]},"results":{"codes":[{"status":204,"language":"json","code":"// Successful request\n{}","name":"Success"},{"status":400,"language":"json","code":"// Key is already assigned\n{\n    \"Type\": \"Metadata Key is already in use for this Asset.\"\n}","name":""},{"language":"text","code":""}]},"settings":"","try":false,"auth":"required","params":[{"_id":"5480ca8c76ed952000b74ba2","ref":"","in":"path","required":true,"desc":"Asset ID","default":"","type":"string","name":"assetid"},{"_id":"5570bd47cc189a21001ab4ae","ref":"","in":"body","required":true,"desc":"Array of key/value pairs. See example payload.","default":"","type":"array_mixed","name":"metadataArray"}],"url":"/assets/:assetid/metadata"},"isReference":false,"order":2,"body":"[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Example payload for multiple pairs\\n[\\n  {\\t\\n\\t\\t\\\"key\\\"\\t\\t: \\\"Timecode\\\",\\n  \\t\\\"value\\\" : \\\"06:48:22:29\\\"\\n\\t},\\n\\t{\\t\\n\\t\\t\\\"key\\\"\\t\\t: \\\"ResolutionUnit\\\",\\n  \\t\\\"value\\\" : \\\"inches\\\"\\n\\t}\\n]\",\n      \"language\": \"json\"\n    },\n    {\n      \"code\": \"\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nUsing POST, MediaSilo will add any new keys to the metadata table and will update any existing keys it finds. Consider this example:\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// An asset has the follwing metadata:\\n{\\\"key\\\": \\\"Producer\\\",\\\"value\\\": \\\"Alex Nauda\\\"}\\n\\n\\n// A POST request is made to update the producer and add a location:\\n[\\n  {\\\"key\\\": \\\"Producer\\\",\\\"value\\\": \\\"Mike Delano\\\"},\\n  {\\\"key\\\": \\\"Location\\\",\\\"value\\\": \\\"Boston\\\"}\\n]\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nAt the end of the request, the asset will contain an updated Producer value and a new Location key.\n[block:api-header]\n{\n  \"type\": \"basic\"\n}\n[/block]","excerpt":"Adds custom metadata in form of a key/value pair to an asset. If submitted key already exists then the value for that key will be updated.","slug":"add-metadata","type":"post","title":"Add or Update Metadata"}

postAdd or Update Metadata

Adds custom metadata in form of a key/value pair to an asset. If submitted key already exists then the value for that key will be updated.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Path Params

assetid:
required
string
Asset ID

Body Params

metadataArray:
required
array of mixed
Array of key/value pairs. See example payload.

Result Format


Documentation

[block:code] { "codes": [ { "code": "// Example payload for multiple pairs\n[\n {\t\n\t\t\"key\"\t\t: \"Timecode\",\n \t\"value\" : \"06:48:22:29\"\n\t},\n\t{\t\n\t\t\"key\"\t\t: \"ResolutionUnit\",\n \t\"value\" : \"inches\"\n\t}\n]", "language": "json" }, { "code": "", "language": "text" } ] } [/block] Using POST, MediaSilo will add any new keys to the metadata table and will update any existing keys it finds. Consider this example: [block:code] { "codes": [ { "code": "// An asset has the follwing metadata:\n{\"key\": \"Producer\",\"value\": \"Alex Nauda\"}\n\n\n// A POST request is made to update the producer and add a location:\n[\n {\"key\": \"Producer\",\"value\": \"Mike Delano\"},\n {\"key\": \"Location\",\"value\": \"Boston\"}\n]", "language": "json" } ] } [/block] At the end of the request, the asset will contain an updated Producer value and a new Location key. [block:api-header] { "type": "basic" } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}