Difference between revisions of "PEC-Developer/Current/SCAPI/ConfigurationNamespace"
(Published) |
|||
Line 17: | Line 17: | ||
*{{Link-SomewhereInThisManual|topic=ConfigurationNamespace|anchor=getOption|display text=getOption}} | *{{Link-SomewhereInThisManual|topic=ConfigurationNamespace|anchor=getOption|display text=getOption}} | ||
+ | *{{Link-SomewhereInThisManual|topic=ConfigurationNamespace|anchor=getContextualOption|display text=getContextualOption}} | ||
===getOption=== | ===getOption=== | ||
Line 31: | Line 32: | ||
!Name | !Name | ||
!Type | !Type | ||
− | |||
!Description | !Description | ||
{{!}}- | {{!}}- | ||
{{!}}options | {{!}}options | ||
{{!}}string | {{!}}string | ||
− | |||
{{!}}An array of configuration options or sections to return. Unless otherwise specified, the API will return options from the '''[interaction-workspace]''' section by default. You can specify any of the following: | {{!}}An array of configuration options or sections to return. Unless otherwise specified, the API will return options from the '''[interaction-workspace]''' section by default. You can specify any of the following: | ||
Line 55: | Line 54: | ||
*<nowiki>*.mark-done</nowiki> | *<nowiki>*.mark-done</nowiki> | ||
*<nowiki>*.auto</nowiki> | *<nowiki>*.auto</nowiki> | ||
+ | {{!}}} | ||
+ | {{!}}- | ||
+ | !Returns | ||
+ | {{!}}Array.<{{Link-SomewhereInThisManual|topic=ConfigurationNamespace|anchor=Section|display text=Section}}> | ||
+ | {{!}}} | ||
+ | |||
+ | ===getContextualOption=== | ||
+ | {{{!}} | ||
+ | !Signature | ||
+ | {{!}}<static> getContextualOption(''options'', ''interactionId'') → {Array.<{{Link-SomewhereInThisManual|topic=ConfigurationNamespace|anchor=Section|display text=Section}}>} | ||
+ | {{!}}- | ||
+ | !Description | ||
+ | {{!}}Get configuration options and values in the context of this interaction when they are overridden by a routing strategy. If the interaction is not found or this parameter is missing, the API throws an exception. | ||
+ | {{!}}- | ||
+ | !Parameters | ||
+ | {{!}} | ||
+ | {{{!}} | ||
+ | !Name | ||
+ | !Type | ||
+ | !Description | ||
+ | {{!}}- | ||
+ | {{!}}options | ||
+ | {{!}}string | ||
+ | {{!}}An option or array of options and their values. Unless otherwise specified, the API returns options from the '''[interaction-workspace]''' section by default. You can specify any of the following: | ||
+ | |||
+ | *A single option by name: <tt>genesys.wwe.service.configuration.getOption('voice.auto-answer', succeeded, failed)</tt> | ||
+ | *A subset of options defined by '*': | ||
+ | *A subset of options in a specific section: <tt>genesys.wwe.service.configuration.getOption('interaction-workspace/interaction.case-data.*', succeeded, failed)</tt> | ||
+ | |||
+ | You can use an asterisk '*' as a wildcard, but only at the end of each word. For example: | ||
+ | |||
+ | *voice.* | ||
+ | *voice.auto* | ||
+ | *sipendpoint.* | ||
+ | *CustomAPI/test.* | ||
+ | |||
+ | You cannot use an asterisk at the start of an option or section. For example, the following values are not allowed: | ||
+ | |||
+ | *<nowiki>*.mark-done</nowiki> | ||
+ | *<nowiki>*.auto</nowiki> | ||
+ | {{!}}- | ||
+ | {{!}}interactionId | ||
+ | {{!}}string | ||
+ | {{!}}The unique identifier for the interaction. | ||
+ | {{!}}- | ||
+ | {{!}}succeeded | ||
+ | {{!}}string | ||
+ | {{!}}The callback function to use if the operation is successful. | ||
+ | {{!}}- | ||
+ | {{!}}failed | ||
+ | {{!}}string | ||
+ | {{!}}The callback function to use if the operation fails. | ||
{{!}}} | {{!}}} | ||
{{!}}- | {{!}}- | ||
Line 93: | Line 144: | ||
{{!}}} | {{!}}} | ||
{{!}}} | {{!}}} | ||
+ | |Status=No | ||
+ | }}{{Section | ||
+ | |sectionHeading=Examples | ||
+ | |anchor=examples | ||
+ | |alignment=Vertical | ||
+ | |structuredtext=Consider the following scenario: | ||
+ | |||
+ | #You set <code>interaction-workspace/interaction.case-data.frame-color"="#FFBA00"</code>. | ||
+ | #You also set the override option key: <code>"interaction-workspace/interaction.override-option-key"="IW_OverrideOptions"</code>. | ||
+ | #An interaction arrives with the attached data <code>"IW_OverrideOptions"="CaseDataColor"</code>. | ||
+ | #The transaction object "CaseDataColor" annex has the option <code>"interaction-workspace/interaction.case-data.frame-color"="#FF000088"</code>. | ||
+ | |||
+ | Here's how this scenario would look for each of the Configuration namespace methods: | ||
+ | |||
+ | ===getContextualOption()=== | ||
+ | |||
+ | Use getContextualOption() to get the option:<syntaxhighlight lang="javascript"> | ||
+ | genesys.wwe.service.configuration.getContextualOption("interaction.case-data.frame-color", "1", succeeded, failed) | ||
+ | </syntaxhighlight>You receive this response:<syntaxhighlight lang="json"> | ||
+ | { | ||
+ | "request": "configuration.getContextualOption", | ||
+ | "data": { | ||
+ | "interaction-workspace": { | ||
+ | "interaction.case-data.frame-color": "#FF008000" | ||
+ | } | ||
+ | }, | ||
+ | "userAgent": "WWE Server", | ||
+ | "protocolVersion": 2 | ||
+ | } | ||
+ | </syntaxhighlight>If the interaction isn't found, the failed callback receives this response:<syntaxhighlight lang="json"> | ||
+ | { | ||
+ | "request": "configuration.getContextualOption", | ||
+ | "errorMessage": "Error: Interaction not found.", | ||
+ | "userAgent": "WWE Server", | ||
+ | "protocolVersion": 2 | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ===getOption()=== | ||
+ | Use getOption() to get the option::<syntaxhighlight lang="javascript"> | ||
+ | genesys.wwe.service.configuration.getOption("interaction.case-data.frame-color", succeeded, failed) | ||
+ | </syntaxhighlight>The response includes the original default value of the option instead of the overridden value:<syntaxhighlight lang="json"> | ||
+ | { | ||
+ | "request": "configuration.getOption", | ||
+ | "data": { | ||
+ | "interaction-workspace": { | ||
+ | "interaction.case-data.frame-color": "#FFBA00" | ||
+ | } | ||
+ | }, | ||
+ | "userAgent": "WWE Server", | ||
+ | "protocolVersion": 2 | ||
+ | } | ||
+ | </syntaxhighlight> | ||
|Status=No | |Status=No | ||
}} | }} | ||
}} | }} |
Revision as of 18:00, June 28, 2022
Contents
Learn about the Configuration namespace methods and type definitions in the Service Client API.
Methods
The Configuration namespace includes the following methods:
getOption
Signature | <static> getOption(options) → {Array.<Section>} | ||||||
---|---|---|---|---|---|---|---|
Description | Get configuration options and values for a specific option name or a subset of options from the [interaction-workspace] section or a custom section. | ||||||
Parameters |
| ||||||
Returns | Array.<Section> |
getContextualOption
Signature | <static> getContextualOption(options, interactionId) → {Array.<Section>} | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description | Get configuration options and values in the context of this interaction when they are overridden by a routing strategy. If the interaction is not found or this parameter is missing, the API throws an exception. | |||||||||||||||
Parameters |
| |||||||||||||||
Returns | Array.<Section> |
Type definitions
The Configuration namespace includes the following object types:
Section
Description | Represents the JSON structure of a configuration section. Each section includes a list of key/value pairs for the matching option(s). | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Type | Object | |||||||||
Properties |
|
Examples
Consider the following scenario:
- You set
interaction-workspace/interaction.case-data.frame-color"="#FFBA00"
. - You also set the override option key:
"interaction-workspace/interaction.override-option-key"="IW_OverrideOptions"
. - An interaction arrives with the attached data
"IW_OverrideOptions"="CaseDataColor"
. - The transaction object "CaseDataColor" annex has the option
"interaction-workspace/interaction.case-data.frame-color"="#FF000088"
.
Here's how this scenario would look for each of the Configuration namespace methods:
getContextualOption()
Use getContextualOption() to get the option:genesys.wwe.service.configuration.getContextualOption("interaction.case-data.frame-color", "1", succeeded, failed)
{
"request": "configuration.getContextualOption",
"data": {
"interaction-workspace": {
"interaction.case-data.frame-color": "#FF008000"
}
},
"userAgent": "WWE Server",
"protocolVersion": 2
}
{
"request": "configuration.getContextualOption",
"errorMessage": "Error: Interaction not found.",
"userAgent": "WWE Server",
"protocolVersion": 2
}
getOption()
Use getOption() to get the option::genesys.wwe.service.configuration.getOption("interaction.case-data.frame-color", succeeded, failed)
{
"request": "configuration.getOption",
"data": {
"interaction-workspace": {
"interaction.case-data.frame-color": "#FFBA00"
}
},
"userAgent": "WWE Server",
"protocolVersion": 2
}