Response JS

Skip to end of metadata
Go to start of metadata

 

 

Description

The Response object is a standard object used by Gigya to pass return values of API methods.
The Gigya service uses an asynchronous programming model in which API methods are triggered and then run in the background until they are completed.
Upon successful or unsuccessful completion, the operation invokes a callback function, which is provided by the developer.
The Gigya service expects the callback function to have the standard signature - mycallback(response).
The one parameter that the callback function receives is the response object. The response object contains the values returned from the API method.
The Response object has some common data members, which are values that are returned by all API methods. In addition to the common data members, each API method may define additional members in the response object. Method-specific members are detailed in the reference section for each API call.

 

Common Data Members

FieldTypeDescription
errorCode integer The result code of the operation. Code '0' indicates success, any other number indicates failure. For a complete list of error codes, see the Response Codes and Errors table.
errorMessage string A short textual description of an error associated with the errorCode for logging purposes.
callId string Unique identifier of the transaction, for debugging purposes.
context object The context object passed by the application as a parameter to the API method, or null if no context object has been passed.
statusstringDeprecated. Please use errorCode instead. 
statusMessagestringDeprecated. Please use errorMessage instead.

 

Usage Example

function myCallback(response)
    {
        if (response.errorCode==0)
        {
            // handle normal behavior (depends on the original API method call)
            // ...             
        }
        else
        {
            // handle errors
            alert("An error has occurred!" + '\n' + 
                "Error details: " + response.errorMessage + '\n' +  
                "Error code: " + response.errorCode + '\n' +                
                "In method: " + response.operation;
        }
    }