Gigya Job Openings

accounts.search examples REST

Skip to end of metadata
Go to start of metadata

 

  1. Example of a count of accounts:

    SELECT count(*) FROM accounts

    Response to the query:

    {"results": [{ "count(*)": 1527}],
    		"objectsCount": 1,
    		"totalCount": 1527,
    		"statusCode": 200,
    		"errorCode": 0,
    		"statusReason": "OK",
    		"callId": "1234"}
  2. Example of a query using limit and start.  The query lists 3 account fields for users in the USA where the user is 18 years old or more.  The query will return 5 results, starting with the 100th valid user.   

    SELECT profile.firstName, profile.lastName, profile.email FROM accounts WHERE profile.country="US" AND profile.age>=18 LIMIT 5 START 100

    Response to the query:

     {"results": [  
         {"profile": {"email": "g1@gmail.com"} },  
         {"profile": {"firstName": "George", "lastName": "Lucas", "email": "g2@gmail.com" } }, 
         {"profile": {"firstName": "Paris", "lastName": "Radisson" } }, 
         {"profile": {"firstName": "Barry", "lastName": "Ray", "email": "g4@gmail.com" } }, 
         {"profile": {"firstName": "Tina", "lastName": "Tuna", "email": "g5@gmail.com" } }  ], 
     "objectsCount": 5, 
     "totalCount": 1840, 
     "statusCode": 200, 
     "errorCode": 0, 
     "statusReason": "OK", 
     "callId": "123456" }
  3. An illustration of the as keyword, in which fields are renamed in the results.   

    SELECT profile.firstName AS xName, profile.lastName AS xSurname, profile.email AS xemail FROM accounts WHERE profile.likes.category CONTAINS "Website" LIMIT 5

    Response to the query:

    { "results": [ 
        {"profile": {"xName": "Ray", "xSurname": "Ban",   "xemail": "t1@gmail.com" }  },
        {"profile": {"xName": "Tom", "xSurname": "Ray",    "xemail": "t2@gmail.com" }  },
        {"profile": {"xName": "Jim", "xSurname": "Man",   "xemail": "t3@yahoo.com" }  },
        {"profile": {"xName": "Jane", "xSurname": "Big",  "xemail": "t4@gmail.com" }  },
        {"profile": {"xName": "Jan", "xSurname": "Tzorken","xemail": "t5@gigya-inc.com" }  } 
                 ],
      "objectsCount": 5,
      "totalCount": 25,
      "statusCode": 200,
      "errorCode": 0,
      "statusReason": "OK",
      "callId": "12345" }

     

  4. Example of a query using contains. This query counts the accounts who have issued a like for a topic whose name contains the word "Madrid":

    SELECT count(*) FROM accounts WHERE profile.likes.name CONTAINS "Madrid"


    Response to the query

    { 
      "results": 
       [ { "count(*)": 28 } ], 
       "objectsCount": 1, 
       "totalCount": 28, 
       "statusCode": 200, 
       "errorCode": 0,
       "statusReason": "OK", 
       "callId": "1234567" 
    } 
  5. Example of a query using regex. This query searches for religions starting with the letter "A".

    SELECT profile.name, profile.industry, profile.religion FROM accounts WHERE profile.religion = regex('A.*')


    Response to the query:

    {  "results": [  
      { "profile": { "name": "Roger Dodge", "religion": "Atea", "industry": "Computer Software" } },
      { "profile": { "name": "Andy Goslan",  "religion": "Atea", "industry": "Computer Software" } }  ],
      "objectsCount": 2,  
      "totalCount": 2,  
      "statusCode": 200,  
      "errorCode": 0,  
      "statusReason": "OK", 
      "callId": "1234567"
    }
  6. Example of a query using counters. This query returns a list of counters for the account.

    SELECT counters FROM accounts WITH counters


    Response to the query:

    {
      "results": [
        {
           "counters": [
            {"count": 59, "lastUpdatedTimestamp": "1400769604813", "value": 23.0, "path": "/sport", "lastUpdated": "2014-05-22T10:40:04Z", "class": "_pageviews", "period": "1405" },
            {"count": 64, "lastUpdatedTimestamp": "1400769604813", "value": 23.0, "path": "/",      "lastUpdated": "2014-05-22T10:40:04Z", "class": "_pageviews", "period": "total"}  ]   
         }
      ],
      "objectsCount": 1,
      "totalCount": 2,
      "statusCode": 200,
      "errorCode": 0,
      "statusReason": "OK",
      "callId": "7651"
    }