Skip to main content

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 via the API or the DX Studio UI.

FieldPropertyDatatypeDescription
Connector CodeconnectorCodeStringThe connector type, in this case genericWebservice
Connection CodeconnectionCodeStringUnique identifier for the Connection.
Connection NamenameStringUser-friendly name for the Connection.
Connection DescriptiondescriptionStringA short description outlining the nature of the Connection.
Base URLbaseUrlStringThe Base URL of the webservice endpoint.
PathpathStringThis appends to the baseUrl.
MethodmethodStringValid values: GET, POST, PUT, PATCH, DELETE
HeadersbaseHeaders[{header:String, value:String}]Webservice headers
Query ParametersbaseQueryParams[{parameter:String, value:String}]Webservice query parameters

Example:


{
"connectorCode": "genericWebservice",
"connectionCode": "my-connection",
"name": "My Connection",
"config": {
"baseUrl": "https://demopublic.api.com",
"baseHeaders": [
{
"header": "Authorization",
"value": "Bearer 1234qwer"
}
]
}
}

Universal API Connector Connection

Component Configuration

Once you have a Universal API Connector Connection configured, create a Universal API Connector Component.

FieldPropertyDatatypeDescription
Component TypecomponentTypeStringThe Component type, in this case genericWebserviceCall.
Component CodecomponentCodeStringUnique identifier for the Component.
Component NamenameStringUser-friendly name for the Component.
Component DescriptiondescriptionStringA short description outlining the nature of the Component.
No RulesnoRulesBooleanWhether any Experience Rules will be configured on this Component.
ConnectionconnectionCodeStringThe Universal API Connection configured above.
Webservice PathpathStringThis appends to the baseUrl specified in the Connection.
MethodmethodStringValid values: GET, POST, PUT, DELETE. This will override the method specified in the Connection.
Return Full ResponsereturnFullResponseBooleanWhether to return the full response object. (Default: false)
Headersheaders[{header:String, value:String}]These header values are merged on top of the baseHeaders specified in the Connection.
Query ParametersqueryParams[{parameter:String, value:String}]These query parameters are merged on top of the baseQueryParams specified in the Connection.
Query Parameter OptionsqueryParamsOptionsObjectAn object that described how query paramaters will be stringified in the URL path. See details below.
BodybodyString or ObjectThis is the body sent as part of the webservice call.

Universal API Connector Connection

Query Parameter Options

PropertyDatatypeDescription
encodeBooleanURL encode the keys and values. (Default: true)
arrayFormatStringHow array values are rendered. Valid values are: none, bracket, index, comma, separator, bracket-separator (Default: none)
arrayFormatSeparatorStringThe character used to separate array elements when using arrayFormat = separator. (Default: ,)
skipNullBooleanSkip keys with null as the value. (Default: true)
skipEmptyStringBooleanSkip keys with an empty string as the value. (Default: false)

Array Formats

FormatObjectResult
{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 Studio UI. Select your Universal API Component from the listing. Configure the Real-time Context Evaluation and Target Experience sections as necessary.

Universal API Connector Connection