Hello,
I am using the Rest API to interact with our AEM as a Cloud Service environment. When I attempt to use the create folder api, I cant get it to set the Title correctly.
For instance, I used the following request:
POST https://author-xxxxxx-xxxxxxxx.adobeaemcloud.com/content/dam/myfolder
Request Body (Content Type = application/json):
{
"class": "assetFolder",
"properties": {
"title": "My Folder"
}
}
This creates the folder with the correct name, but does not set the title. I tried using jcr:title instead of title in the request, still does not set the title. I even tried dc:title...nothing seems to work.
I even tried to use the API that ends with a wildcard (and uses a multi-part form body), but that one is even worse because it sets the title correctly, but does not use the name request parameter to create folder name (instead using the title request parameter while replacing spaces with underscores).
Has anyone been able to get this to work correctly?
Thanks,
Phil
Solved! Go to Solution.
Views
Replies
Total Likes
Which API are you using?
If you are using the "assets API", then your request URL is not correctly formed, you are missing the "/api/assets" part of it.
If you are using the new experimental folders API, you should give it a try in the playground directly: https://developer.adobe.com/experience-cloud/experience-manager-apis/api/experimental/folders/
Hope this helps.
Hi @PhillipKo ,
It seems you're encountering an issue with setting the title of a folder when creating it via the AEM REST API. Let's try to troubleshoot and find a solution.
Check API Documentation: First, ensure that you are using the correct API endpoint and request payload. Refer to the official Adobe documentation or API reference to verify the correct syntax for creating a folder with a specific title.
Payload Structure: Make sure the payload structure is correct. In your case, the payload seems appropriate, with "class": "assetFolder" specifying that it's an asset folder and "properties" containing the properties you want to set.
Property Name: The property for the folder's title might vary depending on the AEM version and configuration. While "title" is commonly used, it's worth checking the documentation or inspecting the properties of an existing folder to confirm the correct property name.
Alternative Approach: If setting the title directly doesn't work, you might try updating the folder's properties after creation using a separate API call. This approach involves retrieving the newly created folder's path and then updating its properties, including the title.
Testing with Different Property Names: Since "title", "jcr:title", and "dc:title" didn't work for you, it might be worth experimenting with other potential property names. You could try "name" or "displayName" to see if they have any effect.
Reach Out to Adobe Support: If you've tried different approaches and none of them seem to work, consider reaching out to Adobe Support for assistance. They might be able to provide insights or solutions specific to your AEM environment or configuration.
By exploring these steps and potentially combining different approaches, you should be able to resolve the issue with setting the title of a folder via the AEM REST API.
Hi @PhillipKo ,
Folders are like directories as in the traditional file systems. Folder can contain just assets, just folders, or folders and assets. Folders have the following components:
Entities: The entities of a folder are its child elements, which can be folders and assets.
Properties:
I'm able to set the title for the folder with the following, please validate once with your request.
Post http://localhost:4502/api/assets/test/mytestfolder
RequestBody
Which API are you using?
If you are using the "assets API", then your request URL is not correctly formed, you are missing the "/api/assets" part of it.
If you are using the new experimental folders API, you should give it a try in the playground directly: https://developer.adobe.com/experience-cloud/experience-manager-apis/api/experimental/folders/
Hope this helps.
Thanks Esteban - you are correct.....I was using /dam/content instead of /api/assets in my URL. Once I switched that, everything worked as expected.
@PhillipKo I trust the AEM community has been helpful to you. We look forward to seeing you back as either a learner or a mentor. The community thrives with SMEs like you. Please invite your AEM peers to contribute too. Happy AEM learning!
Views
Replies
Total Likes
Hi @PhillipKo ,
I could create a folder and set its title with the following postman request using assets http API,
Authorization is basic with username and password.
I got the below response,
{
"class": [
"core/response"
],
"properties": {
"path": "/api/assets/new folder/*",
"parentLocation": "/api/assets/new%20folder.json",
"referer": "",
"isCreate": true,
"changes": [
{
"argument": "/api/assets/new folder/Hello world",
"type": "created"
}
],
"location": "/api/assets/new%20folder/Hello%20world.json",
"status.message": "Created",
"title": "Content created /api/assets/new folder/*",
"status.code": 201
}
}
and I could check the folder created in CRXDE Lite,
This works as expected. Let me know if you need any more information on this.
Thanks for all the helpful information and guidance everyone! I am a newbie to developing in the AEM environment and appreciate all the support!
Views
Likes
Replies
Views
Like
Replies