Cannot get dateTime variable in idlist

Started by Jingo, July 15, 2017, 07:29:24 PM

Previous topic - Next topic

Jingo

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}



Mario

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
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

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;