Expand my Community achievements bar.

Never miss an update of the Adobe Journey Optimizer Community Lens! Subscribe now to get the latest updates, insights, and highlights delivered straight to your inbox every time a new edition drops.
SOLVED

Upload CSV file for suppression list using API

Avatar

Level 2

I want to upload a CSV file for suppression list using API. but facing "400 bad request" error

https://developer.adobe.com/journey-optimizer-apis/references/suppression/

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

@AkshithaPo 

You can validate with the following curl by selecting the file

Mohan_Dugganab_0-1765949556440.png

 

curl --location 'https://platform.adobe.io/ajo/config/suppression/uploads' \
--header 'Authorization: Bearer <token>' \
--header 'x-api-key: <x-api-key>' \
--header 'x-gw-ims-org-id: <x-gw-ims-org-id>' \
--header 'x-sandbox-name: <x-sandbox-name>' \
--form 'file=@"LbHFcFaS6/sampleCsvTemplate.csv"'

 Also, download the sample file from the UI by clicking on 'Add email or domain'

 

Mohan_Dugganab_0-1765949418257.pngMohan_Dugganab_1-1765949445006.png

 

View solution in original post

7 Replies

Avatar

Community Advisor

@AkshithaPo 

Getting a '400 Bad Request' usually means the server couldn't understand what you sent because the request's format was a bit off. This often happens if there's a typo or mistake in things like the headers, the stuff you put in the URL (query parameters), or the body of the request (like wrong keys, organization ID, access tokens, or just messed-up JSON). Double-check those parts and give it another try!

Thanks, Sathees

Avatar

Level 2

@SatheeskannaK  Facing issue while adding file path in the parameters. Which is why seeing the uploads error.

Avatar

Employee Advisor

Can you share the curl you are using ?

Hopefully, you have set the content-type to multipart/form-data in headers and included the file path as part of the multipart form data.

Mohan_Dugganab_0-1765946296681.png

 

Avatar

Level 2

@Mohan_Dugganab 

curl --request POST \
--header "Authorization: Bearer <ACCESS_TOKEN>" \
--header "x-api-key: <CLIENT_ID>" \
--header "x-gw-ims-org-id: <IMS_ORG_ID>" \
--header "x-sandbox-name: <SANDBOX_NAME>" \
--header "Accept: application/json" \

—header “Content-Type: multipart/form-data”\
--body "file=@/full/path/to/csv"

Avatar

Correct answer by
Employee Advisor

@AkshithaPo 

You can validate with the following curl by selecting the file

Mohan_Dugganab_0-1765949556440.png

 

curl --location 'https://platform.adobe.io/ajo/config/suppression/uploads' \
--header 'Authorization: Bearer <token>' \
--header 'x-api-key: <x-api-key>' \
--header 'x-gw-ims-org-id: <x-gw-ims-org-id>' \
--header 'x-sandbox-name: <x-sandbox-name>' \
--form 'file=@"LbHFcFaS6/sampleCsvTemplate.csv"'

 Also, download the sample file from the UI by clicking on 'Add email or domain'

 

Mohan_Dugganab_0-1765949418257.pngMohan_Dugganab_1-1765949445006.png

 

Avatar

Level 2

Thank you. It is working now. The csv template was the issue. 

Avatar

Administrator

Thanks @AkshithaPo for sharing the update! 🙂



Sukrity Wadhwa