Gigya Job Openings

accounts.search JS

Skip to end of metadata
Go to start of metadata

Description

This method searches and retrieves data from Gigya's Accounts Storage using an SQL-like query.  SQL queries are converted into Gigya's proprietary query language. SQL injection attacks are not possible because queries are both created by the customer and then converted by Gigya. A short delay is possible between the writing of account data and its availability in queries.

Note: This method is also supported in our REST API. If you wish to execute this method from your server, please refer to

REST API > accounts.search.

Syntax

 

Parameters

The following table lists the available parameters:

RequiredNameTypeDescription
querystringAn SQL-like query specifying the data to retrieve. For more information, please refer to the Query language specification section in the REST API.
querySigstringA HMAC_SHA1 signature proving that the search call is in fact coming from your client application, in order to prevent fraud. Follow the instructions in Constructing a Signature using the following base-string:  query  + "_" +  expTime .
Because of the sensitive data involved with constructing a signature (i.e., the use of your secret key), it is recommended that the signature not be built in the client side; rather, signatures should be constructed  on the server and injected into the script.
expTimestringThe GMT time when the signature, provided in the querySig  parameter, should expire. The expected format is the Unix time format (i.e. the number of milliseconds since Jan. 1st 1970). Gigya checks the time when the search request is received. If the time succeeds expTime, the request is considered forged.
callbackfunctionA reference to a callback function. Gigya calls the specified function along with the results of the API method when the API method completes.
The callback function should be defined with the following signature: functionName( response ) .
accountTypesstring

The type of account to retrieve: full or lite. Acceptable values:

  • full (the default value)
  • lite
  • full,lite
    

 

Code Sample

<script type="text/javascript">
        var querySigServer = "<Injected_by_Server>";
        var expTimeServer = "<Injected_by_Server>";

function showSearchInfo(response) {
            alert(JSON.stringify(response));
        }

        var searchParams = {
            query: "SELECT emails FROM accounts WHERE isVerified='true',
            querySig: querySigServer,
            expTime: expTimeServer,
            callback: showSearchInfo
        };

        gigya.accounts.search(searchParams);
</script>

Notes:

  • This sample is not meant to be fully functional code. For brevity's sake, only the code required for demonstrating the API call itself is presented.
  • To run the code on your own domain, add your Gigya API key to the gigya.js URL. A Gigya API key can be obtained on the Site Dashboard page on Gigya's website. Please make sure that the domain from which you are loading the page is the same domain name that you used for generating the API key.
  • In some cases it is necessary to connect/login the user to a provider ? prior to calling the API method. You can learn more in the Social Login guide.