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 2014-10-08 15:23:37

carlvasser
Member
Registered: 2014-10-08
Posts: 2

Need help with metadata and advanced search

Hello all. I was able to get an advanced search working easily with the sample code provided and it works great. I now need, however, to return additional (preferably all fields) for a particular advanced search.

Here's whats's working (advanced search via PHP):
$searchADVResults = $myIMSClient->Search_AdvancedSearch(array("query"=>array(array("fieldId"=>162, "conditionId"=>3, "value"=>"YES"))));

and the following JSON is returned:

{"files":[{"id":20426249951,"parentId":"20425712909","filename":"CDSP-BD401-Hunger-free Life for the Children-06-1311.JPG","filesize":"7204022","pages":"1","mime":"image\/jpeg","thumbUrl":"https:\/\/maxplus.compassion.com\/t.tlx?dO_8C2ndJO5og5d.dYIdh..dUudNBPuv","thumbWidth":75,"thumbHeight":50,"previewUrl":"https:\/\/maxplus.compassion.com\/t.tlx?dO_8C2ndJO5og5d.dSTIdh..dUudjsj7o","previewWidth":1200,"previewHeight":795,"originalWidth":"4928","originalHeight":"3264"},{"id":20426246867,"parentId":"20425712909","filename":"CDSP-BD401-Hunger-free Life for the Children-05-1311.JPG","filesize":"6740104","pages":"1","mime":"image\/jpeg","thumbUrl":"https:\/\/maxplus.compassion.com\/t.tlx?cDWNVT2cMDuINMc.cjicS..cRZcl_o0Y","thumbWidth":75,"thumbHeight":50,"previewUrl":"https:\/\/maxplus.compassion.com\/t.tlx?cDWNVT2cMDuINMc.cfHicS..cRZcRex0d","previewWidth":1200,"previewHeight":795,"originalWidth":"4928","originalHeight":"3264"}],"folders":[]}


However, I can't seem to find the right syntax to call the following function to return all metadata and can't seem to get the syntax of hash fields correct in the PHP line below. I have tried many combinations over the course of an hour and am hoping you guys can point me in the right direction.

The main question:
How would I change this line below to return all metadata for each asset? Just can't seem to get the syntax right (though the line below does work)
$searchADVResults = $myIMSClient->Search_AdvancedSearch(array("query"=>array(array("fieldId"=>162, "conditionId"=>3, "value"=>"YES"))));


Function documentation for reference:
Search.AdvancedSearch(array query[, hash fields = NULL]) → hash

array query
An array of hashes representing the search conditions. See Search Parameters

hash fields
Optionally used to specify whether to also return metadata and published file information

Returns hash
Contains keys files and folders containing summaries for each file or folder found in the search

Offline

#2 2014-11-12 17:55:42

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

Re: Need help with metadata and advanced search

Hi Carl,

The "fields" parameter is optional at the same level as "query", so - formatted for readability:

$myIMSClient->Search_AdvancedSearch(array(
  "query"=>array(
    array("fieldId"=>162, "conditionId"=>3, "value"=>"YES")
  ),
  "fields" => array(
    "metadata"=>true
  )
));

would be the way to request this. You would use a similar structure to make other requests with multiple parameters.

Dominic

Offline

#3 2014-11-12 20:39:18

carlvasser
Member
Registered: 2014-10-08
Posts: 2

Re: Need help with metadata and advanced search

Thank you Dominic! That's exactly what I needed. Much appreciated.

Offline

Board footer