Was this article helpful?

Response

Last modified 11:38, 15 Sep 2014
Table of Contents

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

Field Type Description
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 Error Codes table.
errorMessage string A short textual description of an error associated with the errorCode for logging purposes.
operation string The name of the API method that generated this response.
context object The context object passed by the application as parameter to the API method, or null if no context object has been passed.
status string Deprecated. Please use errorCode instead. 
statusMessage string Deprecated. 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;
        }
    }
Was this article helpful?
Pages that link here
Page statistics
202 view(s) and 1 edit(s)
Social share
Share this page?

Tags

This page has no custom tags.
This page has no classifications.

Comments

You must to post a comment.

Attachments