Conscia Universal API Connector
Conscia's Universal API Connector is a generic webservice connector Component type. You can connect to any REST or GraphQL endpoint with this Component type. You will need to create a Universal API Connector Connection first and select that Connection in the Component configuration. The Connection will provide the Base URL and the Component will provide the specific endpoint.
For maximum flexibility, Conscia recommends using the Universal API Connector over vendor-specific Connections and Components.
Connection Configuration
The following information will help you configure a Universal API Connection in the DX Engine UI or via the API:
Field | Property | Datatype | Description |
---|---|---|---|
Connector Code | connectorCode | String | The connector type, in this case genericWebservice |
Connection Code | connectionCode | String | Unique identifier for the Connection. |
Connection Name | name | String | User-friendly name for the Connection. |
Connection Description | description | String | A short description outlining the nature of the Connection. |
Base URL | baseUrl | String | The Base URL of the webservice endpoint. |
Path | path | String | This appends to the baseUrl . |
Method | method | String | Valid values: GET , POST , PUT , PATCH , DELETE |
Headers | baseHeaders | [{header:String, value:String}] | Webservice headers |
Query Parameters | baseQueryParams | [{parameter:String, value:String}] | Webservice query parameters |
Body | body | String or Object | This is the body sent as part of the webservice call. |
Example:
{
"connectorCode": "genericWebservice",
"connectionCode": "my-connection",
"name": "My Connection",
"config": {
"baseUrl": "https://demopublic.api.com",
"baseHeaders": [
{
"header": "Authorization",
"value": "Bearer 1234qwer"
}
]
}
}
Component Configuration
Once you have a Universal API Connector Connection configured, create a Universal API Connector Component.
Field | Property | Datatype | Description |
---|---|---|---|
Component Type | componentType | String | The Component type, in this case genericWebserviceCall . |
Component Code | componentCode | String | Unique identifier for the Component. |
Component Name | name | String | User-friendly name for the Component. |
Component Description | description | String | A short description outlining the nature of the Component. |
No Rules | noRules | Boolean | Whether any Experience Rules will be configured on this Component. |
Connection | connectionCode | String | The Universal API Connection configured above. |
Webservice Path | path | String | This appends to the baseUrl specified in the Connection. |
Method | method | String | Valid values: GET , POST , PUT , DELETE . This will override the method specified in the Connection. |
Return Full Response | returnFullResponse | Boolean | Whether to return the full response object. (Default: false ) |
Headers | headers | [{header:String, value:String}] | These header values are merged on top of the baseHeaders specified in the Connection. |
Query Parameters | queryParams | [{parameter:String, value:String}] | These query parameters are merged on top of the baseQueryParams specified in the Connection. |
Query Parameter Options | queryParamsOptions | Object | An object that described how query paramaters will be stringified in the URL path. See details below. |
Body | body | String or Object | This is the body sent as part of the webservice call. |
Query Parameter Options
Property | Datatype | Description |
---|---|---|
encode | Boolean | URL encode the keys and values. (Default: true ) |
arrayFormat | String | How array values are rendered. Valid values are: none , bracket , index , comma , separator , bracket-separator (Default: none ) |
arrayFormatSeparator | String | The character used to separate array elements when using arrayFormat = separator . (Default: , ) |
skipNull | Boolean | Skip keys with null as the value. (Default: true ) |
skipEmptyString | Boolean | Skip keys with an empty string as the value. (Default: false ) |
Array Formats
Format | Object | Result |
---|---|---|
{arrayFormat: 'none'} | { a: ['b', 'c'] } | a=b&a=c |
{arrayFormat: 'bracket'} | { a: ['b', 'c'] } | a[]=b&a[]=c |
{arrayFormat: 'comma'} | { a: ['b', 'c'] } | a=b,c |
{arrayFormat: 'index'} | { a: ['b', 'c'] } | a[0]=b&a[1]=c |
{arrayFormat: 'separator', arrayFormatSeparator: '|'} | { a: ['b', 'c'] } | a=b|c |
{arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'} | { a: ['b', 'c'] } | a[]=b|c |
Experience Rule Configuration
To create Experience Rules, go to Manage Experiences -> Experiences in the DX Engine UI. Select your Universal API Component from the listing. Configure the Real-time Context Evaluation and Target Experience sections as necessary.