Class GSRequest

Skip to end of metadata
Go to start of metadata

Description

This class is used for sending a request to the Gigya Service.

 

Properties

TypeNameDescription
stringAPIDomain

The domain of the data center to be used for making API calls. You may override the default domain "us1.gigya.com" and specify an alternative data center to be used. For example: "eu1.gigya.com" for Europe data center or "au1.gigya.com" for Australia data center.

Example:

Clients with sites defined under Gigya's European data center should replace domain references to "us1.gigya.com" with "eu1.gigya.com". To verify data center location see Finding You Data Center.

static boolEnableConnectionPooling
This flag tells the SDK to try and reuse connections to the gigya servers, in order to lower the overheads associated with creating new connections, and to reduce latency. The default value is true. The drawback of long-lived connections is that they may become stale after a while, failing the next request sent on top of them. The SDK attempts to avoid that problem by purging old connections and re-issuing failed requests (just once). If, however, you encounter many failed requests to the Gigya API, you can try turning this feature off.
static intMaxConcurrentConnections
The maximum number of concurrent connections that can remain open to the Gigya servers, assuming EnableConnectionPooling flag was enabled (see above). The default value is 100.
static boolBlockWhenConnectionsExhausted
This property determines whether to block your thread when you attempt to send a new request while all connections are in use.
The default value is true, meaning the SDK will block your thread until a connection frees up. The drawback is that this adds a bit of overhead per request.
If you set this property to false, .Net will queue your requests (as of .Net 3.5).
The disadvantages of this option are that queued requests are delayed significantly (could even reach hours) and are stored in memory. If you send requests faster than the connections pool is able to handle, you risk running out of memory eventually.

Constructors

ConstructorDescription
GSRequest(string apiKey,
                     string secretKey,
                     string apiMethod)
Constructs a request using the following parameters:
  • apiKey - Your Gigya API-Key, which can be obtained from the Dashboard section on Gigya's website (read more in the Site Setup documentation).
  • secretKey - Your Gigya Secret-Key, which can be obtained from the Dashboard section on Gigya's website (read more in the Site Setup documentation).
  • apiMethod - The Gigya API method to call, including namespace. For example: 'socialize.getUserInfo'. Please refer to the REST API reference for the list of available methods.
GSRequest(string apiKey,
                     string secretKey,
                     string apiMethod,
                     Boolean useHTTPS)
Constructs a request using the following parameters:
  • apiKey - Your Gigya API-Key, which can be obtained from the Dashboard section on Gigya's website (read more in the Site Setup documentation).
  • secretKey - Your Gigya Secret-Key, which can be obtained from the Dashboard section on Gigya's website (read more in the Site Setup documentation).
  • apiMethod - The Gigya API method to call, including namespace. For example: 'socialize.getUserInfo'. Please refer to the REST API reference for the list of available methods.
  • useHTTPS - This parameter determines whether the request to Gigya will be sent over HTTP or HTTPS. To send over HTTPS, please set this parameter to 'true'.
GSRequest(string apiKey,
                     string secretKey,
                     string apiMethod,
                     GSObject  clientParams)
Constructs a request using the following parameters:
  • apiKey - Your Gigya API-Key, which can be obtained from the Dashboard section on Gigya's website (read more in the Site Setup documentation).
  • secretKey - Your Gigya Secret-Key, which can be obtained from the Dashboard section on Gigya's website (read more in the Site Setup documentation).
  • apiMethod - The Gigya API method to call, including namespace. For example: 'socialize.getUserInfo'. Please refer to the REST API reference for the list of available methods.
  • clientParams - A GSObject that contains the parameters for the Gigya API method to call. Please refer to the REST API reference and find in the specific method reference the list of method parameters.
GSRequest(string apiKey,
                     string secretKey,
                     string apiMethod,
                     GSObject  clientParams,
                     Boolean useHTTPS,
                     string userKey)
Constructs a request using the following parameters:
  • apiKey - Your Gigya API-Key, which can be obtained from the Dashboard section on Gigya's website (read more in the Site Setup documentation).
  • secretKey - Your Gigya Secret-Key, which can be obtained from the Dashboard section on Gigya's website (read more in the Site Setup documentation).
  • apiMethod - The Gigya API method to call, including namespace. For example: 'socialize.getUserInfo'. Please refer to the REST API reference for the list of available methods.
  • clientParams - A GSObject that contains the parameters for the Gigya API method to call. Please refer to the REST API reference and find in the specific method reference the list of method parameters.
  • useHTTPS - This parameter determines whether the request to Gigya will be sent over HTTP or HTTPS. To send over HTTPS, please set this parameter to 'true'.
  • userKey - A key of an admin user with extra permissions. If this parameter is provided, then the secretKey parameter is assumed to be the app's/userKey's secret key and not the site's secret key.
GSRequest(string accessToken,
                     string apiMethod)
Constructs a request using the following parameters:
  • accessToken - The access token that was earlier obtained in the login process.
  • apiMethod - The Gigya API method to call, including namespace. For example: 'socialize.getUserInfo'. Please refer to the REST API reference for the list of available methods.
GSRequest(string accessToken,
                     string apiMethod,
                     GSObject clientParams)
Constructs a request using the following parameters:
  • accessToken - The access token that was earlier obtained in the login process.
  • apiMethod - The Gigya API method to call, including namespace. For example: 'socialize.getUserInfo'. Please refer to the REST API reference for the list of available methods.
  • clientParams- Containing the parameters for the Gigya API method to call. Please refer to the REST API reference and find in the specific method reference the list of method parameters.

 

Methods

Method Description
static stringBuildQS(bool addQuestionMark,
               GSObject paramDictionary)
Converts a GSObject to a query string. Parameters:
  • addQuestionMark - if set to 'true', the returned string will start with a question mark.
  • paramDictionary - the GSObject to convert.
GSObjectGetParams()Returns a GSObject containing the parameters of this request.
GSResponseSend()Sends the request synchronously. The method returns a GSResponse object which represents Gigya's response.
GSResponseSend(int timeout)Sends the request synchronously. The method returns a GSResponse object which represents Gigya's response. Parameters:
  • timeout - using this parameter you may set a timeout to this request. The timeout is the number of milliseconds till returning timeout response. If the timeout expires, the server will return a response with a "Request Timeout" error (error code 504002).
IAsyncResultBeginSend(AsyncCallback callback,
                    object state)
Sends the request asynchronously. The method returns an object that implements IAsyncResult representing the status of the asynchronous request on which you can wait. See the Calling Synchronous Methods Asynchronously topic. Parameters:
  • callback - references a method to be called when the response is received.
  • state - a developer-defined object that qualifies or contains information about the asynchronous operation. The object is passed back unchanged to the application, as the AsyncState field inside the IAsyncResult parameter of the callback method.

See the Using an AsyncCallback Delegate and State Object topic.

voidSetParam(string param,
                  int value)
Sets a request parameter with a value. If the parameter already exists, the old value is replaced by the specified value. Parameters:
  • param - parameter name to set. Please refer to the REST API reference and find the list of method parameters in the specific method reference.
  • value - the int value to set for the parameter.
voidSetParam(string param,
                  long value)
Sets a request parameter with a value. If the parameter already exists, the old value is replaced by the specified value. Parameters:
  • param - parameter name to set. Please refer to the REST API reference and find the list of method parameters in the specific method reference.
  • value - the long value to set for the parameter.
voidSetParam(string param,
                 bool value)
Sets a request parameter with a value. If the parameter already exists, the old value is replaced by the specified value. Parameters:
  • param - parameter name to set. Please refer to the REST API reference and find the list of method parameters in the specific method reference.
  • value - the bool value to set for the parameter.
voidSetParam(string param,
                 string value)
Sets a request parameter with a value. If the parameter already exists, the old value is replaced by the specified value. Parameters:
  • param - parameter name to set. Please refer to the REST API reference and find the list of method parameters in the specific method reference.
  • value - the string value to set for the parameter.
voidSetParam(string param,
                 GSObject value)
Sets a request parameter with a value. If the parameter already exists, the old value is replaced by the specified value. Parameters:
  • param - parameter name to set. Please refer to the REST API reference and find the list of method parameters in the specific method reference.
  • value - the GSObject value to set for the parameter.
voidSetParam(string param,
                 GSArray value)
Sets a request parameter with a value. If the parameter already exists, the old value is replaced by the specified value. Parameters:
  • param - parameter name to set. Please refer to the REST API reference and find the list of method parameters in the specific method reference.
  • value - the GSArray value to set for the parameter.
static stringUrlEncode(string value)Applies URL encoding rules to the parameter string, and returns the outcome.