Class GSResponse

Skip to end of metadata
Go to start of metadata



Wraps Gigya server's response.



Method Description
GSObjectGetData()Returns the response data. Please refer to the REST API reference, for a list of response data structure per method request.
Note: If the request was sent with the format parameter set to "xml", the getData() will return null and you should use getResponseText() method instead (see below). We only parse response text into a GSObject if the request format is "json" which is the default.
intGetErrorCode()Returns the result code of the operation. Code '0' indicates success, any other number indicates failure. For complete list of server error codes, see the Error Codes table.
stringGetErrorMessage()Returns a short textual description of the response error, for logging purposes.
static stringGetErrorMessage(
        int errorCode)
Returns the textual description, associated with the input errorCode.

Returns a log of the operation for debugging purpose. The format of the log is:


	"errorCode": 403005,
	"errorMessage": "Unauthorized user",
	"statusCode": 403,
	"statusReason": "Forbidden",
	"callId": "d8b041336e354a789553830705203779"
string GetResponseText()The raw response data. The raw response data is in JSON format, by default. If the request was sent with the format parameter set to "xml", the raw response data will be in XML format.
intGetInt(string key,
        int defaultValue)
Methods for retrieving value by key.
For the methods without defaultValue, the method throws GSKeyNotFoundException, if the key is not found.
longGetLong(string key,
        long defaultValue)
boolGetBool(string key,
        bool defaultValue)
stringGetString(string key,
        string defaultValue)
GSObjectGetObject(string key,
   GSObject defaultValue)
GSArrayGetArray(string key,
   GSArray defaultValue)
IEnumerableGet(string path,
  bool attempt_conversion = false)
The method retreives a list of objects/values which match the path parameter and whose type matches the template parameter <T>.
  • Template parameter <T> - the type of the object(s) to obtain. May be one of the following: bool, bool?, int, int?, long, long?, decimal, decimal?, string, GSObject, GSArrayIf the object(s) pointed to by the  path parameter do not match the <T> type, they won't be returned unless attempt_conversion parameter was set to true.
  • path - a dot-delimited path down the objects hierarchy. You can access specific array items using bracket notation ([]). The brackets can specify an explicit index or '*' to traverse all elements.
    For example, if you call the socialize.exportUsers method, then the path "users[0].identities[0].provider" will return a list with a single item being the first user's first social provider. The path "users[*].UID" will return a list containing the UID field in each object in the users array.
  • attempt_conversion - if set to true, Gigya will attempt to convert the type of returned values whose type do not match the template parameter. For example: if the template parameter is and a returned value is the string "2", Gigya will convert the string to the number 2.
Note: if the response contains a null value and you request a non-nullable data type (bool, int, etc) then that response value will be ignored. If you do request a nullable or class type (int?, GSObject, etc) then a null object will be returned.
stringToString()Returns a string representation of the response.