Connecting to RetailAds via SQL
You can use SQL to connect to RetailAds in the CData Virtuality Studio or the Code Editor in the Web UI.
Pre-requisites
You need the endpoint, the client pair, and the Program ID for gaining access to the API.
How to Connect
Before you start retrieving data, you need to run the connector script for RetailAds in the CData Virtuality Studio or the Web UI and input your credentials in the following line:
CALL SYSADMIN.createConnection(
name => 'retailads_src',
jbossCliTemplateName => 'ws',
connectionOrResourceAdapterProperties => 'EndPoint=https://data.retailads.net/api/stats_advertiser,AuthUsername=<AuthUsername>,AuthPassword=<AuthPassword>'
);;
CALL SYSADMIN.createDatasource(
name => 'retailads_src',
translator => 'retailads',
modelProperties => 'prid=<prid>'
);;
CREATE VIEW retailads.Credentials
AS
SELECT
'<label_1>' AS label,
'<EndPoint_1>' AS EndPoint,
'<AuthUsername_1>' AS AuthUsername,
'<AuthPassword_1>' AS AuthPassword,
'<prid_1>' AS prid
UNION ALL
SELECT
'<label_2>' AS label,
'<EndPoint_2>' AS EndPoint,
'<AuthUsername_2>' AS AuthUsername,
'<AuthPassword_2>' AS AuthPassword,
'<prid_2>' AS prid
You may optionally add a multi-tenancy table if you wish to access data from multiple accounts in the API. keep in mind, that you have to manually pass a label parameter to the procedures of the API, which will identify, which credentials should be used in the request. If you are not using multi-tenancy, remove the multitenancy_tablename
parameter from the model properties, as the default value is not intended to be present in production environments.