Third Light Developer Exchange

Code and templating community forum for developers and software integrators

You are not logged in.

Announcement

If you wish to join the Developer Exchange, please contact your account manager - this is to avoid unnecessary spam in the forums. Many thanks for your understanding.

#1 2016-09-04 01:34:00

mdyason
Member
Registered: 2015-01-20
Posts: 43

Format of date in advanced search

We are running some in house competitions and I need to be able to get a list of all images uploaded on a particular day and the person who did the upload.  When I run an advanced search inside the system looking for all images where upload date is specified, this works great.  If I look at the metadata for the files I can see who the owner is.  Now when I do a search through the API I have a number of problems.

the API call I have been trying looks like this: 

{"apiVersion": "1.0.1", 
"action": "Search.AdvancedSearch", 
"inParams": 
		{"sessionId": "Jcv,jZh6PUfTDiPYfNg,QHZLGswGBfo7",
		"query": [{"fieldId": 119, "conditionId": 9, "value": "2016-09-03"}],
		"fields": {"metadata": true}
                 }
} 

I used fieldId of 119 because the relevant (I think) part of the reply from GetSearchConfiguration is

      "IMS Metadata"
    ],
    [
      "Upload Date",
      119,
      [
        [
          "IS",
          7,
          1
        ],
        [
          "IS NOT",
          8,
          1
        ],
        [
          "IS AFTER",
          9,
          1
        ],
        [
          "IS BEFORE",
          10,
          1
        ],
        [
          "IS WITHIN THE NEXT 'N' DAYS",
          19,
          0
        ],
        [
          "IS WITHIN THE LAST 'N' DAYS",
          15,
          0
        ],
        [
          "IS IN THE FUTURE",
          17,
          4
        ],
        [
          "IS IN THE PAST",
          18,
          4
        ],
        [
          "DURING",
          27,
          0
        ],
        [
          "IS MISSING",
          30,
          4
        ]
      ],
      5,
      [],
      8,
      "IMS Metadata"

1.  I do not know the syntax the system is looking for, for the date.  I have tried "20160903"  "20160309"  "03 09 2016"  "03092016" "03-09-2016"  "2016-09-03".  No matter what I put there, I get back every image in the system.  (This is not too bad on our test system, but I would have a problem on production).  I can see the returned upload date/time is a Unix timestamp, but that does not help if i am trying to just specify a date.

2.  For every image that is returned, the metadata does show, but the owner is shown as "".  Is this a bug?  Is there another way to figure out the owner ID.  Ideally i need the login name, but i assume that i will have to strip the userID from the owner in an advanced search then run an API call for every ID to find out who that is?

3.  I can not figure out how to say metadata false (I dont actually want to do this but am curious.  I have used true, "true", false, "false", 0, 1 - nothing seems to make a difference, I get the metadata returned every time.

I assume my problems are with syntax.  Can you tell me what the API call should look like please.  Or is there a better way for me to get the same result.  (I need to know who uploaded how many images on a given day)

Offline

#2 2016-09-04 01:42:40

mdyason
Member
Registered: 2015-01-20
Posts: 43

Re: Format of date in advanced search

I just realized that In the above, i have been using 9 ("IS AFTER"),  instead of 7 ("IS").  I tried all the formats again, using 7 but now I get no files returned at all and I know there are files uploaded today.  So this means my questions remain the same, but there is another one - how would i specify the date if I did want to use "IS AFTER"?

Thanks

Offline

#3 2016-09-14 10:48:05

ben
Third Light Staff
From: Third Light
Registered: 2013-06-06
Posts: 79

Re: Format of date in advanced search

Hi mdyason,

For any date or datetime field, the API requires a unix timestamp. When you just need to specify a date, then the timestamp just needs to be somewhere within that particular day. So a timestamp for "2016-09-03 00:00:00" and "2016-09-03 23:59:59: would equate to the same date as far as the API is concerned. Having said that, it's important to get timezones right. The unixtimestamp needs to be within those times for the local time of the server.

The owner id problem sounds like a bug. Please could you raise this thorough support.

To indicate you don't want metadata, you would either need to not send that key, or set it to null i.e. {"metadata":null}

Best wishes,
Ben

Offline

Board footer