Gigya Job Openings

ids.search examples REST

Skip to end of metadata
Go to start of metadata

Description

This page lists several examples of using the ids.search API.

Examples


  1. Example of searching by UID:

    SELECT emails FROM accounts WHERE UID='_gid_yrmlM9AgNuEV69YVxaksoQ=='

    Response to the query:

    {
      "results": [
        {
          "emails": {
            "verified": [
              "******@mail.com"
            ],
            "unverified": []
          }
        }
      ],
      "objectsCount": 1,
      "totalCount": 1,
      "statusCode": 200,
      "errorCode": 0,
      "statusReason": "OK",
      "callId": "4f7a9ede55e34ede9c4f450ccde28bd0",
      "time": "2014-12-23T10:43:46.606Z"
    }
  2. 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"
    }
  3. Example of a query using limit and start.  The query lists 3 account fields for user accounts in the USA where the user is aged over 18.  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" }
  4. 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" }

     

  5. 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" 
    } 
  6. 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"
    }