Was this article helpful?

Class GSRequest

Last modified 15:35, 12 May 2014
Table of Contents

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

 

Properties

Type Name Description
string APIDomain

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

Clients with sites defined under Gigya's European data center should replace domain references to "us1.gigya.com" with "eu1.gigya.com". To verify site location contact your implementation manager.
static bool EnableConnectionPooling
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 int MaxConcurrentConnections
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 bool BlockWhenConnectionsExhausted
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

Constructor Description
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 = null)
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 admin user'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.
  • 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.

 

Methods

Method Description
static string BuildQS(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.
GSObject GetParams() Returns a GSObject containing the parameters of this request.
GSResponse Send() Sends the request synchronously. The method returns a GSResponse object which represents Gigya's response.
GSResponse Send(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).
IAsyncResult BeginSend(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.

void SetParam(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.
void SetParam(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.
void SetParam(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.
void SetParam(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.
void SetParam(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.
void SetParam(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 string UrlEncode(string value) Applies URL encoding rules to the parameter string, and returns the outcome.
Was this article helpful?
Pages that link here
Page statistics
4018 view(s) and 6 edit(s)
Social share
Share this page?

Tags

This page has no custom tags set.

Comments

You must to post a comment.

Attachments