Expand my Community achievements bar.

SOLVED

Create a folder inside an existing linked folder via API

Avatar

Level 2

Hello everyone,

I've a Fusion job where I create a folder in AEM and then through a custom call to Workfront, I add it as a linked folder in the desired project. I do all this in Fusion because I have a business logic that handles how and what folder i need to create and in which project i need to add it.
The problem arises when i've to create a new folder inside the Linked Folder created in the previous step.

i'm making the following POST request:

 

URL

 /attask/api/v18.0/DOCFDR

 

request JSON body

{"name":"folderName","taskID":"xxyyzz","objCode":"DOCFDR","parentID":"aabbcc"}
 
the error I get in both fusion and postam if I try the same request
{
    "error": {
               "message": "Authorization is required.",
               "title": null,
               "msgKey": "exception.attask",
               "attributes": [""],
                "code": 0
            }        
}
 
Note:  i'm using the Workfront Custom API call module in Workfront Fusion and the connection is working fine because the rest of calls are working as expected
 
I have also checked what the Workfront UI does if I try to create the folder using Add New-> Folder, and I have seen that it makes a call to the internal api with the same parameters that I'm using.
 
If I remove the parentID, the folder is created correctly, but obviously it is created as a normal folder in the documents section of the task.
 
Any help is welcome.
Thanks in advance
1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi Lars, 

just to let you know the adobe's response on this. It seems that there is a workaround to solve the problem and that is to use the new authentication/custom call module to be able to log in first and then do what we need.

 

Steps

 

  1. Generate an AEM Technical Cccount
  2. Add the technical account to Workfront
  3. Ensure it has API privileges in the admin console 
  4. Run a Workfront API call against the user endpoint for that account (hit the initializeStatelessDocumentProviderForUser action)
  5. Use the Adobe Authenticator module to then send the moveToFolder action to Workfront:

Once steps 1-4 are completed step 5 should always work (if you get a 403 error, one of the above steps wasn't completed correctly)

 

And here is what i did

1) call to search user to get the user id in workfront (tech user)

/attask/api/v18.0/USER/search

2) for next step we need the documentProviderConfigID, for this is used this endpoint

/attask/api-internal/DOCCFG/search

3) userID from point 1, docProvId from point 2

attask/api-internal/USER/{{userID}}/initializeStatelessDocumentProviderForUser?documentProviderConfigID={{docProvId}}&providerType=AEM

4) add the Adobe Authenticator module on fusion scenario, configure the technical user account for login and call

PUT /attask/api-internal/DOCU/moveToFolder

 

 

 

View solution in original post

14 Replies

Avatar

Level 10

Hello Victor,

 

good question, I do get the same error message, when trying to create a folder within a linked folder using the Workfront API.

 

As a workaround, as you already set up a Fusion scenario to create a folder in AEM, would it be a possibility to create the subfolder directly in AEM Assets via Fusion?

This should be shown in Workfront as well.

 

Regards

Lars

Avatar

Level 2

Hi Lars, 

thanks for your response.

yes, if the folder is added through AEM, it will work. That's how I have it in another part of the scenario. But that folder is not visible by the API until the user navigates into the UI and the linked folders are opened. On the other hand I need to be able to upload a file from the API to that new linked folder. And I can't do that either.

Avatar

Level 10

What does happen, if you try to upload a document to a linked folder using the API?

I just tried, Fusion shows successful operations, but I cannot find the document in the folder in Workfront...

 

Concerning the visibility of subfolders created through the AEM API, it could be worth a try to test around with the api-unsupported / api-internal.

There are two actions like refreshLinkedFolder and refreshLinkedFolderContents...

 

As the API appears to be somewhat immature with regard to your project, I would create a support ticket directly if necessary.

 

Regards

Lars

Avatar

Level 2

exactly!

 

same behavior trough Fusion, i have 200 response but i cannot find the document and if try it with postman /upload and then /document i get the following error

 

"message": "class com.attask.model.RKDocumentFolder cannot be cast to class com.attask.biz.DocumentsAttachable (com.attask.model.RKDocumentFolder and com.attask.biz.DocumentsAttachable are in unnamed module of loader 'deployment.redrock.ear.java.jar' @36b84ab)",
 
 
(where i can read all the api-internal methods documentation)
 
Thanks in advance

Avatar

Level 10

API-Explorer 

 

SCR-20240919-oylk.png

 

 

Regards

 Lars

Avatar

Level 2

/attask/api-internal/DOCFDR/refreshLinkedFolder?linkedFolderID=3498573094570394 is not working for me

 

{
"error": {
"message": "unrecognized URI format: too many parts"
}
}
 
with PUT method 
 
/attask/api-internal/DOCFDR/refreshLinkedFolder?linkedFolderID=66e9bb3e001469c64fc3790dd9a535bd&action=refreshLinkedFolder
 
using the same apiKey for all my requests i get 
{
"error": {
"message": "Authorization is required.",
"title": null,
"msgKey": "exception.attask",
"attributes": [
""
],
"code": 0
}
}

Avatar

Level 10

Hi, 

 

I couldn't let go of it, so I gave it a try. I get the same error message again with the PUT call.

 

So, I would create a support ticket, as everything from here would be based on workarounds...

 

One possible solution could be to "simulate" the UI action as you already traced using your browsers dev tools.

In this thread you can read, how that is done to turn of inheritance of permissions, as there is no regular API-way for it yet...

 

Regards

Lars

Avatar

Level 2

Thanks Lars,

yes, i already raised a ticket, but as always the Adobe response takes a lot of time.

 

I tried with the "emulation" i did that for another project but now i cant do login neither 

Avatar

Correct answer by
Level 2

Hi Lars, 

just to let you know the adobe's response on this. It seems that there is a workaround to solve the problem and that is to use the new authentication/custom call module to be able to log in first and then do what we need.

 

Steps

 

  1. Generate an AEM Technical Cccount
  2. Add the technical account to Workfront
  3. Ensure it has API privileges in the admin console 
  4. Run a Workfront API call against the user endpoint for that account (hit the initializeStatelessDocumentProviderForUser action)
  5. Use the Adobe Authenticator module to then send the moveToFolder action to Workfront:

Once steps 1-4 are completed step 5 should always work (if you get a 403 error, one of the above steps wasn't completed correctly)

 

And here is what i did

1) call to search user to get the user id in workfront (tech user)

/attask/api/v18.0/USER/search

2) for next step we need the documentProviderConfigID, for this is used this endpoint

/attask/api-internal/DOCCFG/search

3) userID from point 1, docProvId from point 2

attask/api-internal/USER/{{userID}}/initializeStatelessDocumentProviderForUser?documentProviderConfigID={{docProvId}}&providerType=AEM

4) add the Adobe Authenticator module on fusion scenario, configure the technical user account for login and call

PUT /attask/api-internal/DOCU/moveToFolder

 

 

 

Avatar

Level 5

Hi Victor,

 

Did you manage to get it working using those instructions from Adobe?  If so can you kindly help clarify a couple of points for me?

 

Regarding step 3, was this a GET request?  I've done that and it just responds as if it's reading the user but no confirmation that anything happened.  I also tried PUT and POST and they both generated errors.

 

Regarding step 4 did you configure an OAuth2 application in Workfront?  If so, was it the Machine to Machine type?  You mention "configure the technical account for the login" but the only way I can see to do that is if you set up the Fusion Adobe Authenticator connection to use JWT. In that case you can specify a technical account ID, however I've been unable to get that to connect and I believe Adobe has disabled JWT from working since Jan 2025.  Are you still able to set this up and if so how?

 

Thank you in advance for any assistance.

 

Regards, David

Avatar

Level 2

Hi David, sorry for the delay,

Point 3 is a PUT request with the configuration id from the previous GET request, but let me add more details:

1) You need to create the Technical User Account by using the Developer Console trough the Cloud Manager

. Open Cloud Manager

. Select the desired environment

. Open Developer Console

VictorTo2_1-1748610551942.png

Open Integrations Tab

VictorTo2_2-1748610606798.png

Click "Create new Technical Account" button

(You will get a json, save it to future use. And the user is also added to the Admin Console like a normal user)

 

2) Add the tech account as administrator in the admin console

VictorTo2_3-1748610734033.png

 

(i have one account per environment)

 

3) Get fo Document Configuration Provider ID (For this you need to add the AEM connection in Workfront first, i'm using the Cloud Service integration)

GET request

VictorTo2_0-1748610372263.png

4) Get the User ID for the Tech Account (when you add the tech account to the AEM and Workfront product you should see it on both product and you can use it for different proposes)

VictorTo2_4-1748611107762.png

 

5) now with the Document Configuration Provider ID and the User ID you can execute the last step, which is a PUT request

VictorTo2_5-1748611321472.png

As you can see the answer is a UUID, that means that everything has gone well, otherwise you will have an error.

 

Best regards,

 

 

Avatar

Level 5

Thank you @VictorTo2  - I basically already had all the steps right but will try again following your example!

 

Did you see the other part of my question?

Regarding step 4 did you configure an OAuth2 application in Workfront?  If so, was it the Machine to Machine type?  You mention "configure the technical account for the login" but the only way I can see to do that is if you set up the Fusion Adobe Authenticator connection to use JWT. In that case you can specify a technical account ID, however I've been unable to get that to connect and I believe Adobe has disabled JWT from working since Jan 2025.  Are you still able to set this up and if so how?

 

Thank you for any further info on that.

Avatar

Level 2

Oh sorry i forgot that one

you need to use the Workfront custom call API module and configure a new connection with the Tech Account information from JSON file

VictorTo2_0-1748869948498.png

(remember "my" is production and then you have the sb for sandboxes)

Avatar

Level 2

but honestly it becomes complex to do the management from Fusion, some things I have moved to services in AEM that I call through a servlet using AEM connection module in fusion, with credentials, I use the same user tech with the permissions I need.