{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/assets/:assetid/metadata","auth":"required","examples":{"codes":[{"language":"text","code":"","name":""}]},"method":"post","params":[{"name":"assetid","type":"string","default":"","desc":"Asset ID","required":true,"in":"path","ref":"","_id":"5480ca8c76ed952000b74ba2"},{"name":"metadataArray","type":"array_mixed","default":"","desc":"Array of key/value pairs. See example payload.","required":true,"in":"body","ref":"","_id":"5570bd47cc189a21001ab4ae"}],"settings":"","basic_auth":false,"results":{"codes":[{"language":"json","status":204,"name":"Success","code":"// Successful request\n{}"},{"status":400,"name":"","code":"// Key is already assigned\n{\n    \"Type\": \"Metadata Key is already in use for this Asset.\"\n}","language":"json"},{"language":"text","code":""}]},"try":false},"next":{"description":"","pages":[]},"title":"Add or Update Metadata","type":"endpoint","slug":"add-metadata","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.","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]","updates":[],"order":2,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5480c92674904f1a00053c87","version":{"version":"3.0","version_clean":"3.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"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","596e6e42c5b53b00509791b1"],"_id":"54343531bfaa3d0800c4d4af","project":"54343170fa5527080064f449","releaseDate":"2014-10-07T18:47:13.086Z","__v":28,"createdAt":"2014-10-07T18:47:13.086Z","forked_from":"54343170fa5527080064f44c"},"__v":3,"project":"54343170fa5527080064f449","editedParams2":true,"user":"54343147fa5527080064f43f","category":{"sync":{"isSync":false,"url":""},"pages":["5480c92674904f1a00053c87","5480ccadb8caf31a00d771d6","5480ce6283bd5c080064289f","5480ceb383bd5c08006428a1","54ac0da8de18cc1400226de9"],"title":"Metadata","slug":"metadata","order":9,"from_sync":false,"reference":false,"_id":"5480c8fd74904f1a00053c86","__v":5,"version":"54343531bfaa3d0800c4d4af","createdAt":"2014-12-04T20:50:05.267Z","project":"54343170fa5527080064f449"},"createdAt":"2014-12-04T20:50:46.276Z","editedParams":true,"parentDoc":null,"githubsync":""}

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 }}