속성 가져오기(Node.js)
마지막 업데이트: 2024년 7월 20일
- 주제:
- APIs/SDKs
작성 대상:
- 개발자
설명
getAttributes()
은(는) Target에서 실험과 개인화된 경험을 가져오고 특성 값을 추출하는 데 사용됩니다.
방법
getAttributes
TargetClient.getAttributes(mboxNames: Array, options: Object): Promise
매개 변수
이름 | 유형 | 필수 | 기본값 |
---|---|---|---|
mboxNames | 배열 | 예 | 없음 |
options | 개체 | 아니오 | 없음 |
약속
TargetClient.getAttributes()
이(가) 반환한 Promise
은(는) 다음 메서드를 사용하여 개체를 확인합니다.
방법 | 반환 유형 | 설명 |
---|---|---|
getValue(mboxName, key) | Any | 지정된 mbox 이름 및 속성 키에 대한 값을 반환합니다. |
asObject(mboxName) | 개체 | 키 값 쌍이 있는 단순 json 개체 반환 |
getResponse() | getOffers 응답 | getOffers 이(가) 정상적으로 반환한 응답 개체를 반환합니다. |
예
Node.js
const TargetClient = require("@adobe/target-nodejs-sdk");
const CONFIG = {
client: "acmeclient",
organizationId: "1234567890@AdobeOrg"
};
const targetClient = TargetClient.create(CONFIG);
const offerAttributes = await targetClient.getAttributes(["demo-engineering-flags"]);
//returns just the value of searchProviderId from the mbox offer
const searchProviderId = offerAttributes.getValue("demo-engineering-flags", "searchProviderId");
//returns a simple JSON object representing the mbox offer
const engineeringFlags = offerAttributes.asObject("demo-engineering-flags");
// the value of engineeringFlags looks like this
// {
// "cdnHostname": "cdn.cloud.corp.net",
// "searchProviderId": 143,
// "hasLegacyAccess": false
// }
const assetUrl = `http://${engineeringFlags.cdnHostname}/path/to/asset`;
recommendation-more-help
6906415f-169c-422b-89d3-7118e147c4e3