Using Client SDKs for Accessing Adobe APIs
You can try it out directly at
- Adobe Analytics 2.0 Library
- Adobe Audience Manager Customer Data
- Adobe Campaign Standard Library
- Adobe Experience Platform Real-Time Customer Profile
- Adobe Target Library
You can also get started through the CLI by
aio app init, and selecting one of the templates to generate project scaffolding automatically.
While the current implementation focuses on API wrapping, we are looking to add business abstraction layers in the future.
Client SDK Initialization#
In order to initialize the client SDK, you need to provide the API key and access token as mandatory params. Additionally, some APIs require a tenant name (Analytics, Campaign Standard, Target) or org ID (Audience Manager) or both (AEP Customer Profile). Below is an example of AEP Customer Profile.
Copied to your clipboardconst client = await CustomerProfile.init(params.tenant, orgId, params.apiKey, token)
Among these parameters,
token can be obtained from the request headers (more about that in Security Overview). For
token specifically we provide the
getBearerToken(params) method in the auto-generated utilities under
Copied to your clipboard1const token = getBearerToken(params)2const orgId = params.__ow_headers['x-gw-ims-org-id']
The other two params
apiKey have to be passed as default parameters (more details). Particularly, you would set the real values as environment variables in the
.env file that are mapped to the action default params in the
manifest.yml file. Below are sample snippets taken from these files.
Copied to your clipboard1# in .env2SERVICE_API_KEY=your_api_key3CUSTOMER_PROFILE_TENANT=your_tenant_name
Copied to your clipboard1# in manifest.yml2customer-profile:3 function: actions/customer-profile/index.js4 web: 'yes'5 runtime: 'nodejs:12'6 inputs:7 LOG_LEVEL: debug8 tenant: $CUSTOMER_PROFILE_TENANT9 apiKey: $SERVICE_API_KEY10 annotations:11 require-adobe-auth: true12 final: true
Please note that, most of the above steps are already taken care of after actions are created from the app template with
aio app init or
aio app add action commands, supposing your project is properly set up with the relevant API services. All you need to do are setting the value of tenant (if required) and customize the action code for your needs.
Adobe Analytics API 1.4#
While many features of Adobe Analytics API have been migrated to the new 2.0 APIs, a few other features are still available in 1.4 APIs only (e.g. data sources, insertion, real-time data). In that case, you could simply select the
Generic template for your action, and leverage the available
node-fetch module to make HTTP request to the API endpoint directly as shown in the boilerplate code. For reference, please see our example code snippet of getting real-time report data.