I tried to get the tag {File.MD.Nikon::Main\7\FocusMode\0} for a file:
function readTags() {
var params = {
// We use the idlist for the selected files
idlist: IMatch.idlist.fileWindowSelection,
// Get these fields
fields: 'id,name,dateTime,rating,label',
// And these tags in addition,
tagdigitized: 'createdate',
tagcreated: 'datecreated',
tag: '{File.MD.Nikon::Main\7\FocusMode\0}',// name which works in VarToy
tagkeywords: 'hierarchicalkeywords'
}
IMWS.get('v1/files', params).then(function (response) {
console.log(JSON.stringify(response, null, 2));
},.....
but it does not like the syntax.
"description":"One or more tag specifiers refer to unknown or invalid tags.".....
Can't find an example which suits.
tag: '{File.MD.Nikon::Main\7\FocusMode\0}',
=>
tagABC: '{File.MD.Nikon::Main\7\FocusMode\0}',
The tag prefix needs a name so IMWS knows under which name to return the tag. You did it correct for the other tags above this one. Syntax is precise.
And remove the File.MD. in front of the tag name. That's for variables only, not correct tag syntax.
If you say "copy as variable" in the metadata panel you get {File.MD.Nikon::Main\7\FocusMode\0}
but the tooltip say "Nikon::Main\7\FocusMode\0" an thats the right name for the code.
example
IMWS.get('v1/files',{
idlist: IMatch.idlist.fileWindowFilesTotal,
fields: 'id,name,crc',
// Metadata
// tagxxx: tag indicates that metadata is wanted
// xxx name of the variable the result in the respone-object is stored
tagcreator : 'XMP::dc\\creator\\Creator', // !!! \\
tagcreated : 'datecreated',
tagheadline :'headline',
tagcountry :'country',
tagcity :'city',
tagstate :'state',
taglocation :'location',
tagdescription:'description',
tagkeywords : 'hierarchicalkeywords',
tagxxx : 'Nikon::Main\\7\\FocusMode\\0',
tagmodified : 'XMP::xmp\\ModifyDate\\ModifyDate'
}).then(function(response3) {
...
result of the response
{
"files": [
{
"id": 95732,
"name": "20020911_DSCN1852.jpg",
"crc": 4282600532,
"city": "Ardez",
"country": "Schweiz",
"created": "2002:09:11 10:04:09",
"creator": "Klaus Kaempfe",
"description": "Bauzug Fa. Furrer+Frey abgestellt im Bahnhof Ardez.",
"headline": "Urlaub Scuol/Engadin (09/2002)",
"keywords": [
"Bahn|Bahngesellschaft|Bahnbau|Furrer+Frey",
"Bahnbau/Bahndienstfahrzeug|Fahrzeug|Bahndienstlok"
],
"location": "Bhf",
"modified": "2015:06:16 19:47:21+02:00",
"state": "Graubünden",
"xxx": "AF-C"
},
Thank you both. Nothing like an example!
Summary for others reading this:
1. Do not include File.Md
2. Remove the {}
3. replace \ by \\ in the tag name.
4. make up your own tag name by appending xxxxx to "tag".
you then refer to result.files[idx].xxxxx to get the tag's info
See also the Accessing Metadata Tags with /files in the IMatch Code Recipes and Tips (https://www.photools.com/dev-center/doc/imatch/tutorial-recipes.html) which has many working examples, ready to copy an paste.