<style>
#tVar3 {
	margin: 0px !important;
	margin-top: -21px !important;
	margin-left: 0px !important;
	
}
#tVar7 {
	margin: 0px !important;
    margin-top: -28px !important;
    margin-left: -9px !important;
    margin-bottom: -68px !important;
}

</style>

Description

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 part of the Customer Identity and the Profile Management - IDS packages. Both packages are premium platforms that require separate activation. If neither are part of your site package, please contact your Gigya or contact us by filling in a support form on our site. You can also access the support page by clicking "Support" on the upper menu of Gigya's site.

 

Example queries and responses can be viewed at accounts.search examples.

Note: Use a POST request rather than GET if you are using a direct REST call.

Parameters 

 

RequiredNameTypeDescription
querystringAn SQL-like query specifying the data to retrieve. Please refer to the Query language specification section above.
The following parameters are Required only when calling the search method from client side (i.e., Mobile SDKs): 
querySigstringAn 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 . When using cursors, this parameter should only be sent with the initial request and omitted from subsequent requests. *When using querySig the openCursor property is not supported. openCursor is only supported in server-to-server calls that include a userKey and secret.

expTimestringThe GMT time when the signature, provided in the UIDSig parameter, should expire. The expected format is the Unix time format including milliseconds (i.e., the number of seconds since Jan. 1st 1970 * 1000). Gigya checks the time when the search request is received. If the time succeeds expTime, the request is considered forged.
  openCursorBoolean

When set to true, the search response will include, in addition to the first page, another field named nextCursorId, which is used to fetch the next batch of results. This parameter should only be used on the first request and later should be removed from the request. When openCursor is active, the Limit clause sets the number of results returned in the batch and should not be larger than 1000 (one thousand).

Notes:

  • When using a cursor with a  Limit  set, the number of results in a batch is not guaranteed.
  • You cannot use a cursor if you have a group by or when using 'start'.
  • openCursor is not supported when using querySig and can only be used in server-to-server calls that include a userKey and secret.
cursorIdstring

The cursor ID that contains the nextCursorId value received in the first search call.

Notes:

  • You cannot pass both cursorId and query on the same request - cursorId brings the next page for the search for which it was opened. Also, the time between search requests using a cursorId must not exceed 5 minutes (300 seconds).
  • Each request should contain a different cursorId obtained from the response of the previous request (not the first) using the nextCursorId field. The exception to this rule is when a request fails or when a particular result set needs to be resent; in this case, resend the same cursorID (as long as it has not expired) to receive its associated result set.
timeoutintegerThe timeout for the request (in milliseconds). Default value is 20000 (20 seconds). Maximum allowed value is 60000 (60 seconds).
restrictedQuerystringAn SQL-like query specifying the data to retrieve. When using this parameter, the query specified must meet the regex criteria defined for the user making this call.
accountTypesstring

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

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

Sample Requests

<script>
var accountsSearchCodeExampleParams = {
	"api":"accounts.search",
	"langs":"nojs",
	"containerId":"accountsSearchCodeExampleContainer",
	"params": {
		"query":"SELECT * FROM accounts WHERE profile.gender='m' AND profile.age > 25"
	}
}
</script>
<div id="accountsSearchCodeExampleContainer"></div>



<style>
/* *Tabbed Content created with https://developers.gigya.com/display/GD/3+Tab+Generator+-+Internal* */

.activeWindow {
 display: block;
 }
.hiddenWindow {
    display: none;
 }
.offButton {
 border: 1px solid transparent;
 color: #ffffff !important;
 width: 200px !important;
 padding: 5px 10px;
 filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#33a7e3", endColorstr="#49b8f2");
 background: linear-gradient(top, #a7daf5, #72c6f3) !important;
 background: -ms-linear-gradient(top left, #a7daf5, #72c6f3) !important;
 background: -webkit-gradient(linear, left top, left bottom, from(#a7daf5), to(#72c6f3)) !important;
 background: -moz-linear-gradient(top, #a7daf5, #72c6f3) !important;
 margin-bottom: 1px;
 margin-top:1px;
 text-decoration: none;
 border-radius: 3px;
 -moz-border-radius: 3px;
 -webkit-border-radius: 3px;
 cursor: pointer;
 width: 200px !important;
}
.activeButton {
 border: 1px solid #034f7c;
 color:   #ffffff !important;
 width: 200px !important;
 padding: 5px 10px;
 filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#33a7e3", endColorstr="#49b8f2");
 background: linear-gradient(top, #33a7e3, #49b8f2) !important;
 background: -ms-linear-gradient(top left, #33a7e3, #49b8f2) !important;
 background: -webkit-gradient(linear, left top, left bottom, from(#33a7e3), to(#49b8f2)) !important;
 background: -moz-linear-gradient(top, #33a7e3, #49b8f2) !important;
 margin-bottom: 1px;
 margin-top:1px;
 text-decoration: none;
 border-radius: 3px;
 -moz-border-radius: 3px;
 -webkit-border-radius: 3px;
 cursor: pointer;
 width: 200px !important;
 font-weight: bold;
}
.activeButton:hover, .offButton:hover {
 border: 1px solid #149dd6;
 padding: 5px 10px;
 filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#49b8f2", endColorstr="#33a7e3");
 background: linear-gradient(top, #49b8f2, #33a7e3) !important;
 background: -ms-linear-gradient(top left, #49b8f2, #33a7e3) !important;
 background: -webkit-gradient(linear, left top, left bottom, from(#49b8f2), to(#33a7e3)) !important;
 background: -moz-linear-gradient(top, #49b8f2, #33a7e3) !important;
 color: #ffffff !important;
 margin-bottom: 0px;
 margin-top: 1px;
 text-decoration: none;
 border-radius: 3px;
 -moz-border-radius: 3px;
 -webkit-border-radius: 3px;
 cursor: pointer;
 width: 200px !important;
}.activeButton:hover {
 font-weight: bold;
}
</style>
<script type="text/javascript">
function accountsSearch1_switchDiv(activeButton, activeTab) {
 document.getElementById('accountsSearch1_tab1').style.display='none';
 document.getElementById('accountsSearch1_tab2').style.display='none';
 //document.getElementById('accountsSearch1_tab3').style.display='none';
 document.getElementById(activeTab).style.display='block';
 document.getElementById('accountsSearch1_button1').className='offButton';
 document.getElementById('accountsSearch1_button2').className='offButton';
 //document.getElementById('accountsSearch1_button3').className='offButton';
 document.getElementById(activeButton).className='activeButton';
 }
</script>
<!-- ***************OPEN main container*************** -->
<div id="accountsSearch1_mainSwitchingContainer" style="border: 1px solid #dddddd; padding: 10px; border-radius: 12px;">
 <!-- BUTTONS -->
  <input type="button" id="accountsSearch1_button1" class="activeButton" value="Search from accounts" onclick="javascript:accountsSearch1_switchDiv('accountsSearch1_button1', 'accountsSearch1_tab1');" >
<input type="button" id="accountsSearch1_button2" class="offButton" value="Search from emailAccounts" onclick="javascript:accountsSearch1_switchDiv('accountsSearch1_button2', 'accountsSearch1_tab2');" >
<!--<input type="button" id="accountsSearch1_button3" class="offButton" value="" onclick="javascript:accountsSearch1_switchDiv('accountsSearch1_button3', 'accountsSearch1_tab3');" >-->
<!-- START BLOCK A -->
<div id="accountsSearch1_tab1" style="display: block;">
<h3>Search from accounts</h3>

FieldTypeDescription
resultsArrayAn array of Account objects (full or partial objects, based on your selected clause), retrieved from Gigya's Accounts Storage. 
nextCursorIdstringUsed to fetch the next batch of results. This parameter is not returned on the last batch of results, its absence means that the result set is finished.
objectsCountintegerThe number of objects returned in the "results" array.
totalCountintegerThe total number of objects that satisfy the query in the DB. This is useful when fetching a limited amount using the "limit" parameter.


Account Object

FieldTypeDescription

 

{
      "statusCode": 200,
      "errorCode": 0,
      "statusReason": "OK",
      "callId": "31ba039fb8d340ceb2f43d52c89bf187",
      "time": "2015-03-22T11:42:25.943Z",
      "results": [{
            "UID": "17490",
            "isRegistered": true,
            "registeredTimestamp": 1344525120445,
            "registered": "2012-08-09T15:12:00.445Z",    
            "isActive": true,
            "isVerified": false,
            "iRank": 0,
            "loginIDs": {
                "username": "h17490@gmail.com",
                "emails": [],
                "unverifiedEmails": []
            },
            "emails": {
                "verified": [],
                "unverified": ["h17490@gmail.com"]
            },
            "socialProviders": "site",
            "profile": {
                "email": "rastropovich17490@gmail.com",
                "firstName": "Joe",
                "lastName": "Smith",
                "age" : "31",
                "gender" : "m",
                "country" : "US"
            },
            "identities": [{
                "provider": "site",
                "providerUID": "17490",
                "isLoginIdentity": false,
                "gender": "",
                "email": "h17490@gmail.com",
                "allowsLogin": false,
                "isExpiredSession": false,
                "lastUpdated": "2012-08-09T15:12:00.302Z",
                "lastUpdatedTimestamp": 1344525120302,
                "oldestDataUpdated": "2012-08-09T15:12:00.302Z",
                "oldestDataUpdatedTimestamp": 1344525120302}],
            "data": {},
            "created": "2012-08-09T15:12:00.297Z",
            "createdTimestamp": 1344525120297,
            "lastLogin": "0001-01-01T00:00:00Z",
            "lastLoginTimestamp": 0,
            "lastUpdated": "2012-08-09T15:12:00.302Z",
            "lastUpdatedTimestamp": 1344525120302,
            "oldestDataUpdated": "2012-08-09T15:12:00.302Z",
            "oldestDataUpdatedTimestamp": 1344525120302},
        {
            "UID": "10067",
            "isRegistered": true,
            "isActive": true,
            "isVerified": false,
            "iRank": 0,
            "loginIDs": {
                "username": "vich@gmail.com",
                "emails": [],
                "unverifiedEmails": []
            },
            "emails": {
                "verified": [],
                "unverified": ["vich@gmail.com"]
            },
            "socialProviders": "site",
            "profile": {
                "email": "vich10067@gmail.com",
                "firstName": "David",
                "lastName": "Cohen",
                "age" : "50",
                "gender" : "m",
                "country" : "Canada"
            },
            "identities": [{
                "provider": "site",
                "providerUID": "10067",
                "isLoginIdentity": false,
                "gender": "",
                "email": "vich@gmail.com",
                "allowsLogin": false,
                "isExpiredSession": false,
                "lastUpdated": "2012-08-09T15:02:56.969Z",
                "lastUpdatedTimestamp": 1344524576969,
                "oldestDataUpdated": "2012-08-09T15:02:56.969Z",
                "oldestDataUpdatedTimestamp": 1344524576969}],
            "data": {},
            "password": {
                "hash": "YG8PL6PwxlH0+KbUb4vG3w==",
                "hashSettings": {
                  "algorithm": "pbkdf2",
                  "rounds": 5000,
                  "salt": "iIj9T09VwfcvLv/0D7rFkA=="
                }
              },
            "tfaStatus": "forceOff",
            "created": "2012-08-09T15:02:56.961Z",
            "createdTimestamp": 1344524576961,
            "lastLogin": "0001-01-01T00:00:00Z",
            "lastLoginTimestamp": 0,
            "lastUpdated": "2012-08-09T15:02:56.969Z",
            "lastUpdatedTimestamp": 1344524576969,
            "oldestDataUpdated": "2012-08-09T15:02:56.969Z",
            "oldestDataUpdatedTimestamp": 1344524576969
        },
        ...
      ]
}
</div>
<!-- END BLOCK A -->
<!-- ********************************************* -->

<!-- START BLOCK B -->
<div id="accountsSearch1_tab2" style="display: none;">

Search from emailAccounts

FieldTypeDescription
resultsArrayAn array of Account objects  (full or partial objects, based on your selected clause), retrieved from Gigya's Accounts Storage. 
nextCursorIdstringUsed to fetch the next batch of results. This parameter is not returned on the last batch of results, its absence means that the result set is finished.
objectsCountintegerThe number of objects returned in the "results" array.
totalCountintegerThe total number of objects that satisfy the query in the DB. This is useful when fetching a limited amount using the " limit " parameter.
subscriptionsJSON objectContains any subscription data associated with this emailAccount. See Subscriptions Object REST for more information.
emailstringThe email address for this account.
createdstringThe time the account was created in ISO 8601 format, e.g., "2017-06-06T14:34:44.102Z".
tokenstringA unique token belonging to this account, similar to a UID, however, lite accounts do not have UIDs.
lastUpdatedTimestampintegerThe UNIX timestamp the account was last updated, with milliseconds.
hasFullAccountBooleanWhether or not this email address is associated with a full registered account.
dataJSON objectContains any dataSchema members that pertain to this account.
lastUpdatedstringThe time the account was last updated in ISO 8601 format, e.g., " 2017-06-06T14:34:44.102Z ".
hasLiteAccountBooleanWhether or not this email address is associated with a lite account.
channelstring

The type of lite account this emailAccount belongs to. Possible values are:

  • email
profileJSON objectContains any profileSchema members that pertain to this account.
missinginteger 
createdTimestampintegerThe UNIX timestamp the account was created, with milliseconds.

Searching emailAccounts 

Construct your search similar to a regular accounts search, but use emailAccounts, an example follows:

SELECT * FROM emailAccounts WHERE profile.email = '34@34.com'

 

Which will return a response similar to the following:

{
  "results": [
    {
      "createdTimestamp": 1496584985099,
      "subscriptions": {
        "jun4th.a001": {
          "email": {
            "tags": [
              "oneTag",
              "twoTag"
            ],
            "lastUpdated": "2017-06-04T14:03:05.100Z",
            "isSubscribed": true
          }
        }
      },
      "email": "34@34.com",
      "created": "2017-06-04T14:03:05.099Z",
      "token": "c69f5baf20daaee31d77db679a109b3ffc93a37884ec4fd6bef7ba8dcdb2122c",
      "hasFullAccount": true,
      "lastUpdatedTimestamp": 1496588214577,
      "data": {
        "subscribe": false,
        "terms": false
      },
      "lastUpdated": "2017-06-04T14:56:54.577Z",
      "hasLiteAccount": true,
      "channel": "email",
      "profile": {
        "email": "34@34.com",
        "locale": "en"
      }
    }
  ],
  "objectsCount": 1,
  "totalCount": 1,
  "missing": 0,
  "statusCode": 200,
  "errorCode": 0,
  "statusReason": "OK",
  "callId": "58fb7c5cfdb9426b8dcd04bef9eed898",
  "time": "2017-06-06T12:12:57.675Z"
}

 

 

</div>
<!-- END BLOCK B -->
<!-- ********************************************* -->
<!-- START BLOCK C -->
<div id="accountsSearch1_tab3" style="display: none;">
<h3></h3>

 

 

</div>
<!-- END BLOCK C -->
</div> <!-- /mainSwitchingContainer -->
<script>
//document.getElementById('accountsSearch1_button2').click();
</script>

 

 

 

Searches and retrieves data from Gigya Accounts Storage using an SQL-like query. SQL queries are converted into Gigya's proprietary query language.

 

 

<script>
//lssdk.configTooltipIds();
//document.getElementById('toolTipNum0').addEventListener("click", function() {
//  window.open('https://developers.gigya.com/display/GD/Lite+Registration');
//});

$(document).ready(function() {
	document.getElementById('accountsSearch1_tab2').style.display='block';
	lssdk.tableFixer();
	lssdk.addLinkedToolTip('accounts.searchREST-SearchfromemailAccounts','https://developers.gigya.com/display/GD/Lite+Registration','Lite Registration and Subscriptions are premium features. Click here to open the Lite Registration documentation.');
	document.getElementById('accountsSearch1_tab2').style.display='none';
	lssdk.ceg.run(accountsSearchCodeExampleParams);
});
</script>