photools.com Community

IMatch Discussion Boards => IMatch Scripting and Apps => Topic started by: Jingo on July 15, 2017, 07:29:24 PM

Title: Cannot get dateTime variable in idlist
Post by: Jingo on July 15, 2017, 07:29:24 PM
Hmm.. I must be doing something wrong.. but I am trying to retrieve the Exif file date and time and it will not retrieve though I know it exists for the file in the endpoint:

var params = {
    // We use the idlist for the selected files
       idlist: IMatch.idlist.fileWindowSelection,
   // Get these fields
       fields: 'id,name,dateTime,rating,label,bpp,offline',
}
IMWS.get('v1/files',params).then(function(response) {
document.getElementById('imdate').innerHTML = response.files[0].dateTime;
console.log(JSON.stringify(response,null,2));


The field dateTime never populates within the idlist.. any thoughts on what I am doing wrong?

Console log does not show dateTime as coded above:

    {
      "id": 40,
      "name": "NEX-5N_02450.jpg",
      "offline": false,
      "bpp": 24,
      "rating": 0,
      "label": ""
    }




Console log shows dateTime for the image when no fields are requested:

{
      "id": 40,
      "name": "NEX-5N_02450.jpg",
      "namene": "NEX-5N_02450",
      "ext": ".jpg",
      "mimeType": "image/jpeg",
      "lastUpdated": "2016-05-15T11:59:18",
      "dateTime": "2016-05-15T07:59:18",
      "offline": false,
      "protected": false}


Title: Re: Cannot get dateTime variable in idlist
Post by: Mario on July 15, 2017, 07:40:08 PM
IMWS parameter names (including field names) are always in lower-case. But you are requested dateTime, with an upper-case T. You need to request datetime.

See Naming Conventions right at the top of https://www.photools.com/dev-center/doc/imatch/tutorial-recipes.html
Title: Re: Cannot get dateTime variable in idlist
Post by: Jingo on July 15, 2017, 07:42:46 PM
AHA!!  Thx Mario.... nothing like having the software developer on "speed dial"  ;)

Just to note for others.. the request is lowercase but the actual identification is how it presents in the idlist:
    document.getElementById('imdate').innerHTML = response.files[0].dateTime;