Hi, I've been building an asset creator and basically wanted to create an API for managing asset attributes with JavaScript. I want to be able to edit the metadata but I imagine it could be extended to cover a broader range of attributes.
I envisioned it working akin to:
Asset(asset_id).metadata(section, field).get(); Asset(asset_id).metadata(section, field).set(value);
and potentially,
Asset(asset_id).metadata({section1: field1, section2: field2, etc}).get(); Asset(asset_id).metadata({section1: field1, section2: field2, etc}).set([value1, value2, etc.]);
but of course this could be extended to include
Asset(asset_id).details... Asset(asset_id).pageContent...
and while we're at it, things like
Asset(asset_id).parent; //return array if more than one Asset(asset_id).children; //return array of children
would probably be very useful.
The JavaScript side of it is no problem - it's simple to create a class to take care of all the AJAX requests, but I wonder whether it is possible for Matrix to deal with the information?
This all started because I literally just wanted to be able to edit the metadata from javascript, given an asset_id and the metadata field names/section names… (So if someone can tell me how to do that, I'll go away a happy man!)
Thanks,
Adam
ps. We're on Matrix V3.10.0 here, so I can't use the URL to pass the data to a trigger