Node Javascript Core SDK wrapping Adobe Target APIs.
$ 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.
- Initialize the SDK
var sdk = require('@adobe/aio-lib-target')
async function sdkTest() {
//initialize sdk
const targetClient = await sdk.init('<tenant>', 'x-api-key', '<valid auth token>')
}
Init method returns an Instance of Class TargetCoreAPI
- Call methods using initialized sdk
var sdk = require('@adobe/aio-lib-target')
async function sdkTest() {
//initialize sdk
const targetClient = await sdk.init('<tenant>', 'x-api-key', '<valid auth token>')
//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
- TargetCoreAPI
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
- init(tenant, apiKey, token) ⇒
Promise.<TargetCoreAPI>
Returns a Promise that resolves with a new TargetCoreAPI object.
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
Kind: global class
- TargetCoreAPI
- .init(tenant, apiKey, token) ⇒
TargetCoreAPI
- .getActivities([options]) ⇒
Promise.<Response>
- .createABActivity(body, [options]) ⇒
Promise.<Response>
- .createXTActivity(body, [options]) ⇒
Promise.<Response>
- .getABActivityById(id, [options]) ⇒
Promise.<Response>
- .getXTActivityById(id, [options]) ⇒
Promise.<Response>
- .updateABActivity(id, body, [options]) ⇒
Promise.<Response>
- .updateXTActivity(id, body, [options]) ⇒
Promise.<Response>
- .setActivityName(id, name, [options]) ⇒
Promise.<Response>
- .setActivityState(id, state, [options]) ⇒
Promise.<Response>
- .setActivityPriority(id, priority, [options]) ⇒
Promise.<Response>
- .setActivitySchedule(id, schedule, [options]) ⇒
Promise.<Response>
- .deleteABActivity(id, [options]) ⇒
Promise.<Response>
- .deleteXTActivity(id, [options]) ⇒
Promise.<Response>
- .getActivityChangeLog(id, [options]) ⇒
Promise.<Response>
- .getOffers([options]) ⇒
Promise.<Response>
- .getOfferById(id, [options]) ⇒
Promise.<Response>
- .createOffer(body, [options]) ⇒
Promise.<Response>
- .updateOffer(id, body, [options]) ⇒
Promise.<Response>
- .deleteOffer(id, [options]) ⇒
Promise.<Response>
- .getAudiences([options]) ⇒
Promise.<Response>
- .createAudience(body, [options]) ⇒
Promise.<Response>
- .getAudienceById(id, [options]) ⇒
Promise.<Response>
- .updateAudience(id, body, [options]) ⇒
Promise.<Response>
- .deleteAudience(id, [options]) ⇒
Promise.<Response>
- .getProperties([options]) ⇒
Promise.<Response>
- .getPropertyById(id, [options]) ⇒
Promise.<Response>
- .getMBoxes([options]) ⇒
Promise.<Response>
- .getMBoxByName(name, [options]) ⇒
Promise.<Response>
- .getMBoxProfileAttributes([options]) ⇒
Promise.<Response>
- .getEnvironments([options]) ⇒
Promise.<Response>
- .getABActivityPerformance(id, [options]) ⇒
Promise.<Response>
- .getXTActivityPerformance(id, [options]) ⇒
Promise.<Response>
- .getActivityPerformance(id, [options]) ⇒
Promise.<Response>
- .getOrdersReport(id, [options]) ⇒
Promise.<Response>
- .executeBatch(body) ⇒
Promise.<Response>
- .init(tenant, apiKey, token) ⇒
targetCoreAPI.init(tenant, apiKey, token) ⇒ TargetCoreAPI
Initialize sdk.
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 |
List activities. Get a list of activities created in your Target account, with the ability to filter and sort by attributes.
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 |
Create AB Activity. Creates a new AB activity with the specified contents and returns the created activity.
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 |
Create XT Activity. Creates a new XT activity with the specified contents and returns the created activity.
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 |
Get AB activity. Fetch the current definition of an AB activity if it is found as referenced by the id.
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 |
Get XT activity. Fetch the current definition of XT activity if it is found as referenced by the id.
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 |
Update AB activity. Updates the AB activity definition with the contents as provided in the request. This can change the state and behaviour of an existing activity.
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 |
Update XT activity. Update the current definition of XT activity if it is found as referenced by the id.
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 |
Update activity name. Updates the name of the AB activity that is referenced by the supplied id.
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 |
Update Activity state. Update state of an activity if it is found as referenced by the id.
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 |
Update Activity priority. Update priority of an activity if it is found as referenced by the id.
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 |
Update Activity schedule. Update schedule of an activity if it is found as referenced by the id.
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 |
Delete AB activity. Deletes the AB activity that is referenced by the id, if it is found.
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 |
Delete XT activity. Delete the current definition of an XT activity if it is found as referenced by the id.
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 |
Get Activity changelog. Returns the changelog for a given activity id.
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 |
List Offers. Retrieve the list of previously-created content offers. The parameters passed through the query string are optional and are used to indicate the sorting and filtering options.
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 |
Get Offer. Retrieves the contents of an offer given an offer id.
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 |
Create Offer. Creates a new content offer as defined by the request data.
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 |
Update Offer. Updates the content offer referenced by the id.
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 |
Delete Offer. Deletes the content offer referenced by the provided id.
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 |
List Audiences. List all available audiences with options to filter and sort by each available field.
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 |
Create Audience. Create a new audience as specified by the contents of the request and return the newly-created audience definition.
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 |
Get Audience. Get the audience definition specified by the provided id.
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 |
Update Audience. Update an audience with the new rules specified by the request data.
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 |
Delete Audience. Delete the audience referenced by the specified id.
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 |
List Properties. Get a list of properties.
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 |
Get Property. Retrieve property by property Id..
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 |
List MBoxes. List all available mboxes for a specific client with the options to filter and sort.
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 |
Get MBox by name. Get the list of mbox parameters.
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 |
Get Profile Attributes. Retrieve the list of available profile attributes and mbox parameters of type profile.
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 |
Get Environments. List all available environments with the options to filter and sort. Use the Environments API to retrieve the environment IDs corresponding to the various host groups set for the client.
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 |
Get AB activity performance. Retrieve property by property Id.
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 |
Get activity performance. Retrieve property by property Id.
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 |
Get activity performance. Retrieve the performance report data for the Automated Personalization activity referenced by the provided id.
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 |
Get Orders report. Retrieve the orders/audit report data for an AB, XT or Autotmated Personalization Activity.
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 |
Execute Batch APIs. Multiple Admin APIs can be executed as a single batch request.
Kind: instance method of TargetCoreAPI
Returns: Promise.<Response>
- a Promise resolving to a Response
Param | Type | Description |
---|---|---|
body | object |
json to execute batch |
init(tenant, apiKey, token) ⇒ Promise.<TargetCoreAPI>
Returns a Promise that resolves with a new TargetCoreAPI object.
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 <your_call_here>
Contributions are welcome! Read the Contributing Guide for more information.
This project is licensed under the Apache V2 License. See LICENSE for more information.