Expand my Community achievements bar.

SOLVED

AEP - Upsert

Avatar

Level 1

Hi, 

 

My data is: Email: abc@test.com, Firstname: abc, Lastname: xyz

I want to change it to:  Email: abc@test.com, Firstname: abc, Lastname: xyz, City:Pune, Address:Halli

 

Steps i followed:

1)Created a dataset.

2) Disabled for profiling

3) Enabled for profiling and upsert.

 

When i want to create a new record, i send through API. Second time i sent through Batch, Upsert works perfect.

 

But when i create a new record through api, and try to update data through api by using below,

        "operations": {

            "data": "merge"

}

It does not work. Please note that  I have only 1 identity which is email so i did not create identity dataset.

Please let me know where I am going wrong ?

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello 

 

using upsert via an API should us the following format.

 

curl --location 'https://dcs.adobedc.net/collection/<collectionid>?synchronousValidation=true' \
--header 'Authorization: Bearer <token>' \
--header 'x-api-key: <API-KEY>' \
--header 'x-gw-ims-org-id: <org>' \
--header 'x-sandbox-name: sandbox \
--header 'x-adobe-flow-id: <flowid>' \
--header 'Content-Type: application/json' \
--data-raw '{
"header": {
"flowId" : "<flowid>",
"imsOrgId": "<oprgiID",
"datasetId": "<dataSetID>",
"operations": {
"data": "merge"
}
},
"body": {
"_<tenant>": {
<profile details>
}
}
}
}

View solution in original post

9 Replies

Avatar

Community Advisor

Hi @AnujaBh - Does your connection url has multiple datasets associated with it? Are you already passing flowid and dataset in the header?

 

Avatar

Level 1

Hi @arpan-garg ,

 

I am using only 1 dataset. And yes my header does have flowid and dataset id. Below is what is not working for me:

"operations":{
        "data": "merge"
    }
Example:
 
When i send email, firstname, lastname to create a record, i used "data":"create" 
then i used "data":"merge" to send, email, firstname, lastname, City. City got appended.
But when i used merge, and sent email and Zip, all other details like firstname, lastname, city got deleted and only email and zip stayed.
 

Avatar

Community Advisor

Hi @AnujaBh - I also face the same issue now.  Seems like something recently changed @abhinavbalooni  - You have any idea on why the upsert is not working?

 

 

Avatar

Level 1

In my body of the request, I had this "xdmEntity", which I removed and it started working. See if you too have that.

 

Avatar

Community Advisor

Can you paste the body here?

 

If you are not using xdmEntity then are you mapping the fields via data mapper?

 

 

Avatar

Community Advisor

I am always getting the following error - 

"detail": "The value supplied for the 'body' field does not match your input schema. Update the 'body' value and try again.",
 
@arijitg  @abhinavbalooni - any idea on this?

Avatar

Correct answer by
Community Advisor

Hello 

 

using upsert via an API should us the following format.

 

curl --location 'https://dcs.adobedc.net/collection/<collectionid>?synchronousValidation=true' \
--header 'Authorization: Bearer <token>' \
--header 'x-api-key: <API-KEY>' \
--header 'x-gw-ims-org-id: <org>' \
--header 'x-sandbox-name: sandbox \
--header 'x-adobe-flow-id: <flowid>' \
--header 'Content-Type: application/json' \
--data-raw '{
"header": {
"flowId" : "<flowid>",
"imsOrgId": "<oprgiID",
"datasetId": "<dataSetID>",
"operations": {
"data": "merge"
}
},
"body": {
"_<tenant>": {
<profile details>
}
}
}
}

Avatar

Community Advisor

Hi @brekrut  - Did you tried it recently? Because i tried it and i get an error 

 

{
"status": 400,
"title": "Invalid request field",
"detail": "The value supplied for the 'body' field does not match your input schema. Update the 'body' value and try again.",
"report": {
"requestId": "739424ca-6995-4cfb-b5f3-26020eae565c",
"inletId": "d17cf367c583f455ab4d5b92f8fa3e7df94ce84bb3bfa2eb218ee8e537ee8405",
"imsOrgId": "BCF356A25FBF85370A495EA3@AdobeOrg",
"xactionId": "739424ca-6995-4cfb-b5f3-26020eae565c"
}
}
 
 
"Ingestion on Experience Data Model (XDM) Entity Update messages (with JSON PATCH operations) for Profile updates via the DCS inlet has been deprecated. As an alternative, you can ingest raw data into the DCS inlet and specify the necessary data mappings to transform your data into XDM-compliant messages for Profile updates."

Avatar

Community Advisor

hello @arpan-garg 

 

Yes I have used this payload to ingest using upsert via an API.

 

You will need to specify the body of the payload inbound of the dataset.