new SklikApi(usernameopt, passwordopt)
Constructor of the Sklik API Connector instance. Example usage:
var sklik = new SklikAPI.SklikApi("user@seznam.cz", "*****");
If no arguments are given, you have to authenticate manually using the client.login
call:
var sklik = new SklikAPI.SklikApi();
sklik.Client.login("user@seznam.cz", "*****");
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
username |
string |
<optional> |
Username used to log-in to the Sklik API. |
password |
string |
<optional> |
Password used to log-in to the Sklik API. |
Classes
Methods
authRpcCall(name, params, userless) → {Object}
Calls the XML-RPC service of Sklik API. Current session ID (and optionally user ID) is automatically passed as the first argument of the operation (user struct).
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name of the operation to call. |
params |
Array | Call parameters. The parameters must be in the same order as used in the API. The user struct with session ID must not be passed, sice it will be automatically prepended! |
userless |
boolean | If set to TRUE, the user ID is not used in the call - must be set for operations without userId field in user struct. |
Returns:
Parsed response struct from Sklik API.
- Type
- Object
listContextNetworks() → {Object}
List context networks (alias for the Contextnetwork.listContextNetworks()
call).
Returns:
List of context networks.
- Type
- Object
listConversionTypes() → {Object}
List of conversion types (alias for the Conversions.listConversionTypes()
call).
Returns:
List of conversion types.
- Type
- Object
listPredefinedRegions() → {Object}
List of predefined regions (alias for the Campaigns.listPredefinedRegions()
call).
Returns:
List of predefined regions.
- Type
- Object
listSearchServices() → {Object}
List of search services (alias for the Campaigns.listSearchServices()
call).
Returns:
List of search services.
- Type
- Object
loginFromProperties(userPropopt, passPropopt)
Login to Sklik api with credentials stored in user properties. Example usage:
var sklik = new SklikAPI.SklikApi();
sklik.loginFromProperties();
The call will search for user properties sklik_user
and sklik_pass
defined
in the user properties section of the project.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
userProp |
string |
<optional> |
Name of the property with username. Defaults to sklik_user |
passProp |
string |
<optional> |
Name of the property with password. Defaults to skiik_pass |
rpcCall(name, params) → {Object}
Calls the XML-RPC service of Sklik API. If Sklik2Json gateway is set, it is used to proxy the request.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name of the operation to call. |
params |
Array | Call parameters. The parameters must be in the same order as used in the API. |
Returns:
Parsed response struct from Sklik API.
- Type
- Object
setSklik2JsonUrl(gatewayUrl)
Sets URL of the Sklik2Json gateway. The gateway is used to preprocess the XML responses to JSON.
Example usage:
var sklik = new SklikAPI.SklikApi();
sklik.setSklik2JsonUrl("<proxy url>");
sklik.loginFromProperties();
Parameters:
Name | Type | Description |
---|---|---|
gatewayUrl |
string | URL of the gateway. |
setUserId(uid)
Sets user ID. List of users can be listed using the client.get
call:
var sklik = new SklikAPI.SklikApi();
sklik.loginFromProperties();
var client = sklik.Client.get();
// `client.foreignAccounts` contains an array of objects with `userId` property
Parameters:
Name | Type | Description |
---|---|---|
uid |
number | User ID to use in subsequent API calls. |