Skip to content

1.3 Class GSRequest PHP

Levi edited this page Jun 11, 2026 · 2 revisions

Description

This class is used for sending a request to SAP Customer Data Cloud from Gigya Service.

Constructor Summary

Constructor Description
GSRequest(string $apiKey,
string $secretKey,
string $apiMethod,
GSObject $params = null,
boolean $useHTTPS = false,
string $userKey = null)
Constructs a request using the following parameters:
  • apiKey - Your Gigya API-Key which can be obtained from the DashboardInformation published on non-SAP site section on Gigya's website (Read more in the Site Selector documentation).
  • secretKey - Your Gigya Secret-Key which can be obtained from the DashboardInformation published on non-SAP site section on Gigya's website (Read more in the Site Selector 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.
  • params (optional) - 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 (optional) - If you wish to send the request to Gigya using HTTPS, set this parameter to TRUE. By default the request is sent using HTTP in SDK versions < 2.16.0.
  • userKey (optional) - A key of an admin/application 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. Note: you may pass an OAuth 2.0Information published on non-SAP site access_token instead of passing APIKey+SecretKey. Pass the access_token as the first parameter (instead of APIKey) and null as the second (instead secretKey). Learn more about OAuth 2.0 and how to receive an access_token here
  • 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.

Method Summary

Method Description undefined
static string buildQS(GSObject $params) Converts a GSObject to a query string.
GSObject getParams() Returns the 'params' field of the request.
GSResponse send(integer $timeout=null) Sends the request synchronously. The method returns a GSResponse object which represents Gigya's response. Parameter:
  • timeout (optional) - 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).
static void setCAFile(string $filename) Give Gigya the path to the CA file on your computer. Set the filename parameter with the full path to the CA file on your computer.
void setParam(string $param, mixed $val) Sets a request parameter with a value.
static string UrlEncode(string $value) Applies URL encoding rules to the parameter string, and returns the outcome.
void setProxy(string $proxy,
string $proxyUserPass=":",
integer $proxyType=CURLPROXY_HTTP)
This method provides an option to specify a proxy, through which this request will be sent. Parameters:
  • proxy (mandatory) - IP address of the proxy.
  • proxyUserPass (optional) - This parameter allows authentication via proxy. The format of this parameter is: "username:password".
  • proxyType (optional) - This parameter sets the proxy type on the cURL session. The parameter may receive one of the two constans: CURLPROXY_HTTP (default) or CURLPROXY_SOCKS5.
void setCurlOptionsArray(array $curlArray) This method enables setting multiple options for a cURL session, in addition to the option that is supported with the GSRequest.setProxy method. Parameter:
  • apiDomain (mandatory) - The domain of the data center to be used. For example:
    Language Code Snippet
    PHP
    setAPIDomain("<Data_Center>");      

Clone this wiki locally