Adobe Target SDK
npm install @adobe/aio-lib-target

!Node.js CI


``bash`
$ npm install
The Adobe Target 1.0 APIs need to set an Accepts header for them to work properly. With version 2.x or greater of this SDK, we set the proper Accepts header for the calls as documented. Previous versions of this SDK may or may not work since for some Target API calls the Accepts header is not enforced consistently.
For scenarios in which user-based OAuth tokens are used instead of a JWT technical account ones, the user may require specific roles/permissions to be assigned in Adobe Target in order to successfully perform API calls.
Otherwise, the Adobe Target API calls performed by the API Client will result in 500 errors.
For more detailed information, please read the Adobe Target Enterprise user permissions documentation.
`
var sdk = require('@adobe/aio-lib-target')
async function sdkTest() {
//initialize sdk
const targetClient = await sdk.init('
}
`
Init method returns an Instance of Class TargetCoreAPI
2) Call methods using initialized sdk
`
var sdk = require('@adobe/aio-lib-target')
async function sdkTest() {
//initialize sdk
const targetClient = await sdk.init('
//get activities
const activities = await targetClient.getActivities({limit:5, offset:0})
console.log(util.inspect(activities));
//get offers
const offers = await targetClient.getOffers({limit:5, offset:0})
console.log(util.inspect(offers));
//get offer by id activity
const offer = await targetClient.getOfferById(123)
console.log(util.inspect(offer));
}
``
All Methods available under sdk are documented here
This class provides methods to call Adobe Target APIs.
Before calling any method initialize the instance by calling init method on it
with valid tenant, apiKey and auth token
Promise.<TargetCoreAPI>Returns a Promise that resolves with a new TargetCoreAPI object.
Kind: global class
* TargetCoreAPI
* .init(tenant, apiKey, token) ⇒ TargetCoreAPI
* [.getActivities([options])](#TargetCoreAPI+getActivities) ⇒ Promise.<Response>
* [.createABActivity(body, [options])](#TargetCoreAPI+createABActivity) ⇒ Promise.<Response>
* [.createXTActivity(body, [options])](#TargetCoreAPI+createXTActivity) ⇒ Promise.<Response>
* [.getABActivityById(id, [options])](#TargetCoreAPI+getABActivityById) ⇒ Promise.<Response>
* [.getXTActivityById(id, [options])](#TargetCoreAPI+getXTActivityById) ⇒ Promise.<Response>
* [.updateABActivity(id, body, [options])](#TargetCoreAPI+updateABActivity) ⇒ Promise.<Response>
* [.updateXTActivity(id, body, [options])](#TargetCoreAPI+updateXTActivity) ⇒ Promise.<Response>
* [.setActivityName(id, name, [options])](#TargetCoreAPI+setActivityName) ⇒ Promise.<Response>
* [.setActivityState(id, state, [options])](#TargetCoreAPI+setActivityState) ⇒ Promise.<Response>
* [.setActivityPriority(id, priority, [options])](#TargetCoreAPI+setActivityPriority) ⇒ Promise.<Response>
* [.setActivitySchedule(id, schedule, [options])](#TargetCoreAPI+setActivitySchedule) ⇒ Promise.<Response>
* [.deleteABActivity(id, [options])](#TargetCoreAPI+deleteABActivity) ⇒ Promise.<Response>
* [.deleteXTActivity(id, [options])](#TargetCoreAPI+deleteXTActivity) ⇒ Promise.<Response>
* [.getActivityChangeLog(id, [options])](#TargetCoreAPI+getActivityChangeLog) ⇒ Promise.<Response>
* [.getOffers([options])](#TargetCoreAPI+getOffers) ⇒ Promise.<Response>
* [.getOfferById(id, [options])](#TargetCoreAPI+getOfferById) ⇒ Promise.<Response>
* [.createOffer(body, [options])](#TargetCoreAPI+createOffer) ⇒ Promise.<Response>
* [.updateOffer(id, body, [options])](#TargetCoreAPI+updateOffer) ⇒ Promise.<Response>
* [.deleteOffer(id, [options])](#TargetCoreAPI+deleteOffer) ⇒ Promise.<Response>
* [.getAudiences([options])](#TargetCoreAPI+getAudiences) ⇒ Promise.<Response>
* [.createAudience(body, [options])](#TargetCoreAPI+createAudience) ⇒ Promise.<Response>
* [.getAudienceById(id, [options])](#TargetCoreAPI+getAudienceById) ⇒ Promise.<Response>
* [.updateAudience(id, body, [options])](#TargetCoreAPI+updateAudience) ⇒ Promise.<Response>
* [.deleteAudience(id, [options])](#TargetCoreAPI+deleteAudience) ⇒ Promise.<Response>
* [.getProperties([options])](#TargetCoreAPI+getProperties) ⇒ Promise.<Response>
* [.getPropertyById(id, [options])](#TargetCoreAPI+getPropertyById) ⇒ Promise.<Response>
* [.getMBoxes([options])](#TargetCoreAPI+getMBoxes) ⇒ Promise.<Response>
* [.getMBoxByName(name, [options])](#TargetCoreAPI+getMBoxByName) ⇒ Promise.<Response>
* [.getMBoxProfileAttributes([options])](#TargetCoreAPI+getMBoxProfileAttributes) ⇒ Promise.<Response>
* [.getEnvironments([options])](#TargetCoreAPI+getEnvironments) ⇒ Promise.<Response>
* [.getABActivityPerformance(id, [options])](#TargetCoreAPI+getABActivityPerformance) ⇒ Promise.<Response>
* [.getXTActivityPerformance(id, [options])](#TargetCoreAPI+getXTActivityPerformance) ⇒ Promise.<Response>
* [.getActivityPerformance(id, [options])](#TargetCoreAPI+getActivityPerformance) ⇒ Promise.<Response>
* [.getOrdersReport(id, [options])](#TargetCoreAPI+getOrdersReport) ⇒ Promise.<Response>
* .executeBatch(body) ⇒ Promise.<Response>
Kind: instance method of TargetCoreAPI
Returns: TargetCoreAPI - a TargetCoreAPI instance
| Param | Type | Description |
| --- | --- | --- |
| tenant | string | Adobe Target tenant name |
| apiKey | string | Your api key |
| token | string | Valid auth token |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | object | | to control activity search |
| [options.limit] | number | 2147483647 | Defines the number of items to return |
| [options.offset] | number | 0 | Defines the first activity to return from the list of total activities. Used in conjunction with limit, you can provide pagination in your application for users to browse through a large set of activities. |
| [options.sortBy] | string | | Defines the sorting criteria on the returned items |
| [options.headers] | object | | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| body | object | Activity JSON. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| body | object | Activity JSON. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Activity id. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Activity id. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Activity id. |
| body | object | activity JSON |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Activity id. |
| body | object | activity JSON |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Activity id. |
| name | string | New Activity name. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Activity id. |
| state | string | New Activity state. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Activity id. |
| priority | string | New Activity priority. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Activity id. |
| schedule | string | New Activity schedule. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Activity id. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Activity id. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Activity id. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | object | | to control offer search. |
| [options.limit] | number | 2147483647 | Defines the number of items to return |
| [options.offset] | number | 0 | Defines the first offers to return from the list of Offers. Used in conjunction with limit, you can provide pagination in your application for users to browse through a large set of offers. |
| [options.sortBy] | string | | Defines the sorting criteria on the returned items. |
| [options.headers] | object | | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Offer id. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| body | object | Offer JSON. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Offer id. |
| body | object | Offer JSON |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Offer id. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | object | | options to control audience search. |
| [options.limit] | number | 2147483647 | Defines the number of items to return. Default value is 2147483647 |
| [options.offset] | number | 0 | Defines the first audience to return from the list of total offers. Used in conjunction with limit, you can provide pagination in your application for users to browse through a large set of offers. |
| [options.sortBy] | string | | Defines the sorting criteria on the returned items. |
| [options.headers] | object | | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| body | object | Audience JSON. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Audience id. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Audience id. |
| body | object | audience JSON |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Audience id. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Property id. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| name | string | MBox name. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Activity id. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Activity id. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Activity id. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| id | number | Activity id. |
| [options] | object | sdk options |
| [options.headers] | object | headers to pass to API call |
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response> - a Promise resolving to a Response
| Param | Type | Description |
| --- | --- | --- |
| body | object | json to execute batch |
Promise.<TargetCoreAPI>Kind: global function
Returns: Promise.<TargetCoreAPI> - Promise resolving to a TargetCoreAPI instance
| Param | Type | Description |
| --- | --- | --- |
| tenant | string | tenant Adobe Target tenant name |
| apiKey | string | apiKey Your api key |
| token | string | Valid auth token |
LOG_LEVEL=debug
Contributions are welcome! Read the Contributing Guide for more information.
This project is licensed under the Apache V2 License. See LICENSE for more information.