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 2018-03-08 18:08:44

LyssaLionheart
Member
Registered: 2017-06-13
Posts: 12

API Error

Hello All,

I had a simple app setup around the middle of last year that would get the details of all the images that were uploaded in the last 24 hours. This worked without issue until December 12th of last year while I was away. I have just noticed it isn't doing it's job anymore and it is generating a 500 internal server error. We apparently did an upgrade in late October, but I can't imaging that is the issue since it ran for a month and a half without issue.

API Script:
api.json.tlx?json={"apiVersion":"1.0","action": "Search.AdvancedSearch","inParams": {"query":[{"fieldId":19,"conditionId":-1,"value":"-1"},{"fieldId":119,"conditionId":15,"value":"1"}],"exactMatches":"false","fields":{"metadata":"true"}}}

FieldId 19 = FILE TYPE
conditionId -1 = IS AN IMAGE

FieldId 119 = UPLOAD DATE
conditionId 15 = IS WITHIN THE LAST 'N' DAYS

I have tested this API in postman and it generates the same error. We have also done a reboot on the server and I verified that the fieldId's and conditionId's in our metadata are still correct.

Any help on this issue would be greatly appreciated.

Thanks,
Melissa

Offline

#2 2018-03-08 19:25:52

dominic
Third Light Staff
Registered: 2013-06-06
Posts: 119

Re: API Error

Hi Melissa,

I imagine that the first condition "IS AN IMAGE" is likely to match a rather large number of files - and a number which will have been increasing over time. It is likely that December was the point at which this partial result became too large to process.

I suggest trying the search with the conditions transposed, as just the set of files uploaded in the last day is likely to be quite small. By applying that condition first, you should find that the search will succeed - and it ought to be quite a bit faster, too.

Dominic

Offline

#3 2018-03-12 17:01:18

LyssaLionheart
Member
Registered: 2017-06-13
Posts: 12

Re: API Error

Hi Dominic,

I am not sure what you mean by trying the search with the conditions transposed. Would you be able to provide an example?

Thanks,
Melissa

Offline

#4 2018-03-13 10:47:14

dominic
Third Light Staff
Registered: 2013-06-06
Posts: 119

Re: API Error

{"apiVersion":"1.0","action": "Search.AdvancedSearch","inParams": {"query":[
{"fieldId":119,"conditionId":15,"value":"1"},
{"fieldId":19,"conditionId":-1,"value":"-1"}
],"exactMatches":"false","fields":{"metadata":"true"}}}

- so the order of the search conditions in the query is first the 'in the last 1 day' condition, followed by the 'is an image' condition.

Offline

#5 2018-03-13 17:02:52

LyssaLionheart
Member
Registered: 2017-06-13
Posts: 12

Re: API Error

Thanks Dominic, that worked!

So the order that the query goes in matters. I assumed it worked like a traditional and statement where the two are evaluated at the same time.

Really appreciate the help.
Melissa

Offline

Board footer