Jump to: navigation, search
(Created target blank page For Version: PSAAS:Julie)
 
(Automated save: adding PEC_Migrated template.)
 
Line 1: Line 1:
<!-- Creation of the target page -->
+
= API Commands =
 +
 
 +
{{Template:PEC_Migrated}}
 +
 
 +
 
 +
 
 +
Once you've registered your own plugin on the bus, you can call commands on other registered plugins. Below we'll quickly register a new plugin on the bus using the global bus object.
 +
 
 +
{{NoteFormat|The global bus object is a debug tool. When implementing Widgets on your own site, do not use the global bus object to register your custom plugins. Instead, see [[GWCBusExtensions|Widgets Extensions]] for more information about extending Genesys Widgets.|1}}
 +
 
 +
<source lang='javascript'>var oMyPlugin = window._genesys.widgets.bus.registerPlugin('MyPlugin');
 +
 
 +
oMyPlugin.command('StatsService.getStats');</source>
 +
 
 +
== configure ==
 +
Internal use only. The main App plugin shares configuration settings to widgets using each widget’s configure command. The configure command can only be called once at startup. Calling configure again after startup may result in unpredictable behavior.
 +
<br /><br />
 +
=== Example ===
 +
<source lang='javascript'>
 +
oMyPlugin.command('StatsService.configure', {
 +
 
 +
ewt:{
 +
 
 +
apikey: '12345',
 +
dataURL: 'http://localhost:8080/foo/bar'
 +
},
 +
ajaxTimeout: 10000
 +
 
 +
}).done(function(e){
 +
 
 +
// StatsService configured successfully
 +
 
 +
}).fail(function(e){
 +
 
 +
// StatsService failed to configure
 +
});
 +
</source>
 +
 
 +
<br />
 +
=== Options ===
 +
{|
 +
|-
 +
! Option
 +
! Type
 +
! Description
 +
|-
 +
| ewt.apikey
 +
| string
 +
| API access token. Please contact your Genesys representative to obtain your API access token.
 +
|-
 +
| ewt.dataURL
 +
| URL String
 +
| URL of GMS server
 +
|-
 +
| ajaxTimeout
 +
| number
 +
| Number of milliseconds to wait before AJAX timeout.
 +
|-
 +
|}
 +
<br />
 +
 
 +
=== Resolutions ===
 +
{|
 +
|-
 +
! Status
 +
! When
 +
! Returns
 +
|-
 +
| resolved
 +
| When configuration options are provided and set
 +
| n/a
 +
|-
 +
| rejected
 +
| When no configuration options are provided
 +
| 'Invalid configuration'
 +
|-
 +
|}
 +
== getStats ==
 +
Make a request to Genesys Stats server to fetch EWT details.
 +
<br /><br />
 +
=== Example ===
 +
<source lang='javascript'>
 +
oMyPlugin.command('StatsService.getStats', {
 +
 
 +
group: 'EWT',
 +
vqName: 'chat_ewt_test_eservices',
 +
mode: 'urs2'
 +
 
 +
}).done(function(e){
 +
 
 +
// StatsService got stats successfully
 +
 
 +
}).fail(function(e){
 +
 
 +
// StatsService failed to get stats
 +
});
 +
</source>
 +
 
 +
<br />
 +
=== Options ===
 +
{|
 +
|-
 +
! Option
 +
! Type
 +
! Description
 +
|-
 +
| group
 +
| string
 +
| Mention specific group name you would like to request like EWT, etc.
 +
|-
 +
| vqname
 +
| string/array
 +
| Specify a single virtual queue name as a string or a list of virtual queue names as an array. EWT will be fetched only for these virtual queues specified here. If nothing is specified, EWT will be fetched for all the available virtual queues.
 +
|-
 +
| mode
 +
| string
 +
| Specify EWT mode. This will vary based on [[StatsServiceConfiguration#Options|apiVersion]]. Refer to [[StatsServiceConfiguration#Options|mode]] configuration option for possible values.
 +
|-
 +
|}
 +
<br />
 +
=== Resolutions ===
 +
{|
 +
|-
 +
! Status
 +
! When
 +
! Returns
 +
|-
 +
| resolved
 +
| When server returns EWT data
 +
| (AJAX Response Object)
 +
|-
 +
| rejected
 +
| When server fail request fails
 +
| 'EWT request failed due to unknown reason'
 +
|-
 +
| rejected
 +
| When no EWT dataURL provided
 +
| 'Invalid EWT configuration'
 +
|-
 +
|}
 +
 
 +
[[Category:V:PSAAS:Julie]]

Latest revision as of 23:19, June 21, 2020

API Commands

Important
This content may not be the latest Genesys Engage cloud content. To find the latest content, go to Genesys Engage cloud for Administrators.



Once you've registered your own plugin on the bus, you can call commands on other registered plugins. Below we'll quickly register a new plugin on the bus using the global bus object.

Important
The global bus object is a debug tool. When implementing Widgets on your own site, do not use the global bus object to register your custom plugins. Instead, see Widgets Extensions for more information about extending Genesys Widgets.
var oMyPlugin = window._genesys.widgets.bus.registerPlugin('MyPlugin');

oMyPlugin.command('StatsService.getStats');

configure

Internal use only. The main App plugin shares configuration settings to widgets using each widget’s configure command. The configure command can only be called once at startup. Calling configure again after startup may result in unpredictable behavior.

Example

oMyPlugin.command('StatsService.configure', {

	ewt:{

		apikey: '12345',
		dataURL: 'http://localhost:8080/foo/bar'
	},
	ajaxTimeout: 10000

}).done(function(e){

	// StatsService configured successfully

}).fail(function(e){

	// StatsService failed to configure
});


Options

Option Type Description
ewt.apikey string API access token. Please contact your Genesys representative to obtain your API access token.
ewt.dataURL URL String URL of GMS server
ajaxTimeout number Number of milliseconds to wait before AJAX timeout.


Resolutions

Status When Returns
resolved When configuration options are provided and set n/a
rejected When no configuration options are provided 'Invalid configuration'

getStats

Make a request to Genesys Stats server to fetch EWT details.

Example

oMyPlugin.command('StatsService.getStats', {

	group: 'EWT',
	vqName: 'chat_ewt_test_eservices',
	mode: 'urs2'

}).done(function(e){

	// StatsService got stats successfully

}).fail(function(e){

	// StatsService failed to get stats
});


Options

Option Type Description
group string Mention specific group name you would like to request like EWT, etc.
vqname string/array Specify a single virtual queue name as a string or a list of virtual queue names as an array. EWT will be fetched only for these virtual queues specified here. If nothing is specified, EWT will be fetched for all the available virtual queues.
mode string Specify EWT mode. This will vary based on apiVersion. Refer to mode configuration option for possible values.


Resolutions

Status When Returns
resolved When server returns EWT data (AJAX Response Object)
rejected When server fail request fails 'EWT request failed due to unknown reason'
rejected When no EWT dataURL provided 'Invalid EWT configuration'
This page was last edited on June 21, 2020, at 23:19.
Comments or questions about this documentation? Contact us for support!