Lesson 6: Profile Management APIs - Adobe-Marketing-Cloud/target-api-examples GitHub Wiki

##Objective In this lesson we will learn how to use profile api to inspect and update profiles without using mbox calls. We will then use the attributes that were updated offline in custom success metrics.

For this lesson, we will be working with your thirdpartyId, please visit your Travel website

http://adobe-marketing-cloud.github.io/target-api-examples/travel-demo/labuser<USERNUMBER>.html

For example: http://adobe-marketing-cloud.github.io/target-api-examples/travel-demo/labuser71.html

Now scroll down to see your third party id.

##Exercise 1: Profile fetch api

Lets see what is stored in your profile using the profile fetch api.

  • Step 1: In Postman, Locate the call titled “06. View profile by thirdPartyId”, update the request url to match your thirdPartyId and click Send.

You should get back a response that looks like the following:

{
    "client": "adobesummit2015",
    "visitorId": "829946593",
    "modifiedAt": "2015-03-08T00:14:22.571-05:00",
    "profileAttributes": {
        "purchaseOnMobile": {
            "value": "true",
            "modifiedAt": "2015-03-08T00:14:22.571-05:00"
        }
    }
}

##Exercise 2: Profile update api

The aim of this step is to show how to update user context profile using profile API. It is a powerful feature to enrich user profile with data coming from other channels/sources such as in-retail POS etc

  • Step 1: In PostMan, locate the method titled 07. Update profile by thirdPartyId

  • Step 2: Update the request with your specific thirdPartyId

  • Step 3: click send
<response>
    <success>true</success>
    <visitorId></visitorId>
    <message>Request successfully submitted</message>
</response>

##Exercise 3: Bulk profile update API

In our current situation, we had just 1 profile to update - so the Profile Update rest call was able to used for that easily. In case you have several profiles to update at the same time, it would not be scalable to call profile update each time. We have the "Bulk Profile update" API for this situation. The Bulk profile update has the following benefits:

  1. Can update upto 500,000 profiles in a single batch file ( Max file size is 60 MB )
  2. Supports thirdPartyId as well as mboxPCId.
  3. Provides a status with the progress of the update, and they are applied asychronously.

Step 1: Using TextEdit, create the a file called "bulkprofile.txt" on your Desktop directory, with the following contents.

Note that you need to replace the thirdPartyId with your value.

batch=thirdPartyId, shippingCountry, visitorType
2158462093, Chicago, Awesome
  • Step 2: Open Terminal from your Dock. Please change directory to the Desktop directory where the bulkprofile.txt is saved.

  • Step 3: Issue the following curl command:

curl -X POST --data-binary @bulkprofile.txt https://adobesummit2015.tt.omtrdc.net/m2/adobesummit2015/profile/batchUpdate -k

This should return the response. Note that "batchId" that is part of the response. This ID identifies this specific set of profiles that were sent for the update using the bulk update api. The batchId can be used to query the status of a batch update for upto 24 hours after a bulk profile update has been submitted.

<response><success>true</success><batchStatus>http://mboxedge19.tt.omtrdc.net/m2/adobesummit2015/profile/batchStatus?batchId=adobesummit2015-890684371&mboxPC=0000000000000-000000.19_17</batchStatus><message>Batch submitted for processing</message></response>
  • Step 4: Check the status, this should go from unknown --> incomplete --> complete, as you check the status mutliple times.
curl -k "http://mboxedge19.tt.omtrdc.net/m2/adobesummit2015/profile/batchStatus?batchId=adobesummit2015-890684371&mboxPC=0000000000000-000000.19_17"
<response><batchId>adobesummit2015-890684371</batchId><status>incomplete</status><batchSize>1</batchSize></response>
curl -k "http://mboxedge19.tt.omtrdc.net/m2/adobesummit2015/profile/batchStatus?batchId=adobesummit2015-890684371&mboxPC=0000000000000-000000.19_17"
<response><batchId>adobesummit2015-890684371</batchId><status>complete</status><batchSize>1</batchSize></response>
  • Step 5: Now, verify the update using the profile fetch api for the thirdPartyId. Please update the thirdpartyid in the calls before issuing the call:
curl -k http://adobesummit2015.tt.omtrdc.net/rest/v1/profiles/thirdPartyId/2158462093?client=adobesummit2015
{"client":"adobesummit2015","visitorId":"2158462093","modifiedAt":"2015-03-07T09:54:26.000-05:00","profileAttributes":{"visitorType":{"value":"Awesome","modifiedAt":"2015-03-07T09:54:26.000-05:00"},"shippingCountry":{"value":"Chicago","modifiedAt":"2015-03-07T09:54:26.000-05:00"}}}

##Conclusion

In this lesson you learnt how to fetch and update profiles using the Adobe Target Profile apis.

⚠️ **GitHub.com Fallback** ⚠️