I was trying get content fragment list using the following documentation.
However it always throws a 302 error instead of 200. I have tried both /content/dam path and /api/assets path but it still does not work.
I am unable to use the curl command to make changes in the content fragment.
Thanks in advance,
Solved! Go to Solution.
Views
Replies
Total Likes
Here's how you can retrieve fragments using the (AEM) Sites API:
curl -i -X GET "http://localhost:4502/adobe/sites/cf/fragments?limit=1&path=/content/dam/&references=direct" -H "Authorization: Basic YWRtaW46YWRtaW4="
Use the API URL provided in the documentation - https://developer.adobe.com/experience-cloud/experience-manager-apis/api/stable/sites/
path: This parameter specifies the DAM path under which you want to search for fragments. Replace /content/dam/ with the desired path in your AEM instance.
Here's how you can retrieve fragments using the (AEM) Sites API:
curl -i -X GET "http://localhost:4502/adobe/sites/cf/fragments?limit=1&path=/content/dam/&references=direct" -H "Authorization: Basic YWRtaW46YWRtaW4="
Use the API URL provided in the documentation - https://developer.adobe.com/experience-cloud/experience-manager-apis/api/stable/sites/
path: This parameter specifies the DAM path under which you want to search for fragments. Replace /content/dam/ with the desired path in your AEM instance.
Hi @vashishth47
I believe this is the default AEM behaviour. If you can see, in the response you have the Location header which has a value different then the one you requested. A trailing / appeared in the end. That is because AEM adds it and makes a redirect to it.
I believe is because of line 185-189 from here:
https://github.com/apache/sling-org-apache-sling-servlets-get/blob/master/src/main/java/org/apache/s...
And everything starts because your request is extensionless. If you add a .html in your cUrl, you should be able to get 200 HTTP response.
Here is a working example to use CF OpenAPI
curl 'http://localhost:4502/adobe/sites/cf/fragments?limit=1&references=direct-hydrated&path=%2Fcontent%2Fdam%2Fsuppliercontent%2Fitems%2Ftest' \
-H 'Authorization: Basic YWRtaW46YWRtaW4='
error is coz your fetch url is incorrect. change as per example and should work.