|
5 | 5 |
|
6 | 6 | Documentation can be found at https://mypurecloud.github.io/platform-client-sdk-python/ |
7 | 7 |
|
8 | | -Documentation version PureCloudPlatformClientV2 215.0.0 |
| 8 | +Documentation version PureCloudPlatformClientV2 216.0.0 |
9 | 9 |
|
10 | 10 | ## Preview APIs |
11 | 11 |
|
@@ -124,6 +124,43 @@ region = PureCloudPlatformClientV2.PureCloudRegionHosts.us_east_1 |
124 | 124 | PureCloudPlatformClientV2.configuration.host = region.get_api_host() |
125 | 125 | ``` |
126 | 126 |
|
| 127 | +#### Setting the gateway |
| 128 | + |
| 129 | +The Genesys Cloud Login and API URL path can be overridden if necessary (i.e. if the Genesys Cloud requests must be sent through to an intermediate API gateway or equivalent). |
| 130 | + |
| 131 | +This can be achieved setting the gateway on the `ApiClient` instance with *set_gateway*. You can use *None* as parameter's value for default configuration (e.g. "https" for protocol, -1 for port, ...). |
| 132 | + |
| 133 | +```python |
| 134 | +apiClient = PureCloudPlatformClientV2.api_client.ApiClient() |
| 135 | +apiClient.set_gateway("mygateway.mydomain.myextension", "https", 1443, "myadditionalpathforlogin", "myadditionalpathforapi") |
| 136 | +apiClient.get_client_credentials_token(os.environ['GENESYS_CLOUD_CLIENT_ID'], |
| 137 | + os.environ['GENESYS_CLOUD_CLIENT_SECRET']) |
| 138 | +``` |
| 139 | + |
| 140 | +or setting as default for all clients |
| 141 | + |
| 142 | +```python |
| 143 | +gateway_configuration = PureCloudPlatformClientV2.GatewayConfiguration() |
| 144 | +gateway_configuration.host = "mygateway.mydomain.myextension"; |
| 145 | +gateway_configuration.protocol = "https"; |
| 146 | +gateway_configuration.port = 1443; |
| 147 | +gateway_configuration.path_params_login = "myadditionalpathforlogin"; |
| 148 | +gateway_configuration.path_params_api = "myadditionalpathforapi"; |
| 149 | +... |
| 150 | +PureCloudPlatformClientV2.configuration.gateway_configuration = gateway_configuration |
| 151 | +``` |
| 152 | + |
| 153 | +* "host" is the address of your gateway. |
| 154 | +* "protocol" is not mandatory. It will default to "https" if the parameter is not defined or empty. |
| 155 | +* "port" is not mandatory. This parameter can be defined if a non default port is used and needs to be specified in the url (value must be greater or equal to 0). Set to -1 to use default port (default unspecified port). |
| 156 | +* "path_params_login" and "path_params_api" are not mandatory. They will be appended to the gateway url path if these parameters are defined and non empty (for Login requests and for API requests). |
| 157 | +* "username" and "password" are not used at this stage. This is for a possible future use. |
| 158 | + |
| 159 | +With the configuration below, this would result in: |
| 160 | + |
| 161 | +* Login requests to: "https://mygateway.mydomain.myextension:1443/myadditionalpathforlogin" (e.g. "https://mygateway.mydomain.myextension:1443/myadditionalpathforlogin/oauth/token") |
| 162 | +* API requests to: "https://mygateway.mydomain.myextension:1443/myadditionalpathforapi" (e.g. "https://mygateway.mydomain.myextension:1443/myadditionalpathforlogin/api/v2/users/me") |
| 163 | + |
127 | 164 | ### Connect to a Proxy Server |
128 | 165 |
|
129 | 166 | If connecting to a proxy server, set the the address of your proxy server as follows: |
@@ -222,6 +259,79 @@ JSON: |
222 | 259 | } |
223 | 260 | ``` |
224 | 261 |
|
| 262 | +The Genesys Cloud Login and API URL path can be overridden if necessary (i.e. if the Genesys Cloud requests must be sent through to an intermediate API gateway or equivalent). |
| 263 | + |
| 264 | +This can be achieved defining a "gateway" configuration, in the INI or the JSON configuration file. |
| 265 | + |
| 266 | +* "host" is the address of your gateway. |
| 267 | +* "protocol" is not mandatory. It will default to "https" if the parameter is not defined or empty. |
| 268 | +* "port" is not mandatory. This parameter can be defined if a non default port is used and needs to be specified in the url (value must be greater or equal to 0). Set to -1 to use default port (default unspecified port). |
| 269 | +* "path_params_login" and "path_params_api" are not mandatory. They will be appended to the gateway url path if these parameters are defined and non empty (for Login requests and for API requests). |
| 270 | +* "username" and "password" are not used at this stage. This is for a possible future use. |
| 271 | + |
| 272 | +With the configuration below, this would result in: |
| 273 | + |
| 274 | +* Login requests to: "https://mygateway.mydomain.myextension:1443/myadditionalpathforlogin" (e.g. "https://mygateway.mydomain.myextension:1443/myadditionalpathforlogin/oauth/token") |
| 275 | +* API requests to: "https://mygateway.mydomain.myextension:1443/myadditionalpathforapi" (e.g. "https://mygateway.mydomain.myextension:1443/myadditionalpathforlogin/api/v2/users/me") |
| 276 | + |
| 277 | +INI: |
| 278 | + |
| 279 | +```ini |
| 280 | +[logging] |
| 281 | +log_level = trace |
| 282 | +log_format = text |
| 283 | +log_to_console = false |
| 284 | +log_file_path = /var/log/pythonsdk.log |
| 285 | +log_response_body = false |
| 286 | +log_request_body = false |
| 287 | +[reauthentication] |
| 288 | +refresh_access_token = true |
| 289 | +refresh_token_wait_max = 10 |
| 290 | +[general] |
| 291 | +live_reload_config = true |
| 292 | +host = https://api.mypurecloud.com |
| 293 | +[gateway] |
| 294 | +host = mygateway.mydomain.myextension |
| 295 | +protocol = https |
| 296 | +port = 1443 |
| 297 | +path_params_login = myadditionalpathforlogin |
| 298 | +path_params_api = myadditionalpathforapi |
| 299 | +username = username |
| 300 | +password = password |
| 301 | +``` |
| 302 | + |
| 303 | +JSON: |
| 304 | + |
| 305 | +```json |
| 306 | +{ |
| 307 | + "logging": { |
| 308 | + "log_level": "trace", |
| 309 | + "log_format": "text", |
| 310 | + "log_to_console": false, |
| 311 | + "log_file_path": "/var/log/pythonsdk.log", |
| 312 | + "log_response_body": false, |
| 313 | + "log_request_body": false |
| 314 | + }, |
| 315 | + "reauthentication": { |
| 316 | + "refresh_access_token": true, |
| 317 | + "refresh_token_wait_max": 10 |
| 318 | + }, |
| 319 | + "general": { |
| 320 | + "live_reload_config": true, |
| 321 | + "host": "https://api.mypurecloud.com" |
| 322 | + }, |
| 323 | + "gateway": { |
| 324 | + "host": "mygateway.mydomain.myextension", |
| 325 | + "protocol": "https", |
| 326 | + "port": 1443, |
| 327 | + "path_params_login": "myadditionalpathforlogin", |
| 328 | + "path_params_api": "myadditionalpathforapi", |
| 329 | + "username": "username", |
| 330 | + "password": "password" |
| 331 | + } |
| 332 | +} |
| 333 | +``` |
| 334 | + |
225 | 335 | ### Making Requests |
226 | 336 |
|
227 | 337 | There are two steps to making requests: |
|
0 commit comments