In this article, we will learn how we can access our already-created content fragments via GraphQL. We will also learn how we can fetch, create, update, and delete adobe aem content fragments using postman. we will also learn about how we can access content fragments of adobe aem using cURL in cmd
- Goto Assets > GraphQL
- Click on Create button > enter project name > select /conf/global and then create button
- then you will find the endpoint created.
- check the endpoint and click on publish
- them you will see the endpoint published
Specific Content Fragments
- syntax: http://localhost:4502/api/assets/folder_name/content_fragment_name.json
- Example http://localhost:4502/api/assets/country/india.json
Post Content Fragments
- endpoint syntax: http://localhost:4502/api/assets/folder_name/content_fragment_name
- Example http://localhost:4502/api/assets/country/unitedstate
{
"properties": {
"cq:model": "/conf/wknd/settings/dam/cfm/models/country-content-model",
"title": "UnitedState",
"description": "UnitedState",
"elements": {
"name": {
"value": "UnitedState",
":type": "text/html",
"variations": {
"Urdu": {
"value": "name in urdu",
":type": "text/html"
}
}
}
}
}
}
Put Content Fragments
- endpoint syntax: http://localhost:4502/api/assets/folder_name/content_fragment_name
- Example http://localhost:4502/api/assets/country/india.json
body
{
"properties": {
"cq:model": "/conf/wknd/settings/dam/cfm/models/country-content-model",
"title": "UnitedStateIndialllll",
"description": "UnitedState",
"elements": {
"name": {
"value": "UnitedStatellllll",
":type": "text/html",
"variations": {
"Urdu": {
"value": "<p>name in urdu</p>",
":type": "text/html"
}
}
}
}
}
}
All Content Fragments
- syntax: http://localhost:4502/api/assets/folder_name/content_fragment_name.json
- Example: http://localhost:4501/api/assets/country/india.json
Access via cURL in cmd
All Content Fragments
- Example curl -u admin: admin http://localhost:4502/api/assets/country
Specific Content Fragments
- Example curl -u admin: admin http://localhost:4502/api/assets/country/india.json
0 comments: