Gigya Job Openings

ds.search JS

Skip to end of metadata
Go to start of metadata

Description

 

This method searches and retrieves data from Gigya's Data Store using an SQL-like query. A short delay is possible between the writing of account data and its availability in queries.

When possible this API should only be used via REST. The querySig param is required and should never be added to the request on the client side, to avoid manipulation.

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 > ds.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 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 on 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).

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 UID='_gid_yrmlM9AgNuEV69YVxaksoQ=='",
            querySig: querySigServer,
            expTime: expTimeServer,
            callback: showSearchInfo
        };
        gigya.ds.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.