Expand my Community achievements bar.

Applications are now open to join the Adobe Journey Optimizer Champion Program. Apply by June 10!
SOLVED

Issue while creating AJO Content Template through Postman API

Avatar

Level 1

Hi, 

 

I am trying to create a content template in AJO using Postman API following this documentation. When I run the POST request in Postman, I get the following response - 

 
Shashank_Shukla_0-1739285509901.png

 

The response suggests that the 'sandboxId' is missing as one of the header parameters. However, I wasn't able to find references on where I can retrieve the 'sandboxId' from, to be able to run this POST request successfully.

 

- Has anybody faced this issue previously?

- How were you able to retrieve the sandboxId to be able to run this request successfully?

- Any other changes that I should incorporate to the request based on the error response?

 

Thanks!
Shashank

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@Shashank_Shukla 

code below works for me 

 

DavidKangni_0-1739547569443.png

 

curl --location 'https://platform.adobe.io/ajo/content/templates' \
--header 'x-api-key: <string>' \
--header 'x-gw-ims-org-id: <string>' \
--header 'x-sandbox-name: <string>' \
--header 'Content-Type: application/vnd.adobe.ajo.template.v1+json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <access_token>' \
--data '{
    "name": "ar html test1",
    "description": "jhgkjhk",
    "templateType": "html",
    "channels": [
        "email"
    ],
    "source": {
        "origin": "ajo",
        "metadata": {}
    },
    "template": {
        "html": "<html>hello</html>",
        "editorContext": {}
    }
}'


David Kangni

View solution in original post

4 Replies

Avatar

Community Advisor

Hi @Shashank_Shukla 

 

AEP/AJO API calls use sandbox name not sandbox id. I will recommend to check instead header for application/content as 406 is more an API error related to the media you're loading.

 

Another way to debug is to use a get Template API to check if you are able to hit the endpoint. 

Thanks,

David



David Kangni

Avatar

Level 1

Thanks, @DavidKangni ! I triggered a GET request and was successfully able to hit the endpoint. However, the error with the POST request persists.

Here is the cURL for the request I am triggering, if that provides more insight into the issue - 

curl --location 'https://platform.adobe.io/ajo/content/templates' \
--header 'Authorization: Bearer {redacted}' \
--header 'x-api-key: {redacted}' \
--header 'x-gw-ims-org-id: {redacted}@AdobeOrg' \
--header 'x-sandbox-name: {redacted}' \
--header 'Content-Type: application/json' \
--data '{

"name":"ar html test1",
"description":"jhgkjhk",
"templateType":"html",

"channels":[
"email"
],
"source":{
"origin":"ajo",
"metadata": { }
},
"template":{
"html":"<html>hello</html>",
"editorContext":{ }
}
}'

 

If you have a working API for creating the content template, could you please share so I can give that a try as well?

 

Thanks,
Shashank

Avatar

Correct answer by
Community Advisor

@Shashank_Shukla 

code below works for me 

 

DavidKangni_0-1739547569443.png

 

curl --location 'https://platform.adobe.io/ajo/content/templates' \
--header 'x-api-key: <string>' \
--header 'x-gw-ims-org-id: <string>' \
--header 'x-sandbox-name: <string>' \
--header 'Content-Type: application/vnd.adobe.ajo.template.v1+json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <access_token>' \
--data '{
    "name": "ar html test1",
    "description": "jhgkjhk",
    "templateType": "html",
    "channels": [
        "email"
    ],
    "source": {
        "origin": "ajo",
        "metadata": {}
    },
    "template": {
        "html": "<html>hello</html>",
        "editorContext": {}
    }
}'


David Kangni

Avatar

Level 1

Thank you, @DavidKangni! Able to create the template now.