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-11-25 17:57:21

stevesmith
Member
Registered: 2014-11-25
Posts: 11

PHP JSON example

Hi,

I'm trying to modify the PHP JSON sample code to covert the General Search to an Advanced Search but getting the error message :

SEARCH_QUERY_FIELD_CONDITION_INVALID

Can anyone point me in the right direction ?

Here is my request :

$strJSONRequest='{
"apiVersion":"1.0",
"sessionId":"' . $strSessionId . '",
"inParams":{"query":[{"fieldId":"Title","conditionId":0,"value":"SS"}],"fields":{"metadata":true}},
"action":"Search.AdvancedSearch"
}';

The general search which works ok is :

$strJSONRequest='{
"apiVersion":"1.0",
"sessionId":"' . $strSessionId . '",
"inParams":{"query":"4850","exactMatches":false},
"action":"Search.GeneralSearch"
}';

Thanks

Steve Smith
Aberystwyth

Offline

#2 2014-11-26 17:08:11

steve
Third Light Staff
Registered: 2013-06-06
Posts: 105

Re: PHP JSON example

Hi Steve,

Try to supply a numeric value to fieldId instead . You can use Search_GetSearchConfiguration() to receive an array describing each possible seach field.

As an example, the following will search the keyword field for the word 'test'
http://yoursite.com/api/1.0/Search.Adva … rch/query=[{"fieldId":"106","conditionId":"0","value":"test"}]

Best Regards,
Steve

Offline

#3 2014-11-27 10:22:39

stevesmith
Member
Registered: 2014-11-25
Posts: 11

Re: PHP JSON example

Thanks Steve,

I got the field ID number but still getting the same error with :

$strJSONRequest='{
"apiVersion":"1.0",
"sessionId":"' . $strSessionId . '",
"inParams":{"query":[{"fieldId":"1","conditionId":"0","value":"a"}]},
"action":"Search.AdvancedSearch"
}';

Steve

Offline

Board footer