cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve all aspect and type definitions from Alfresco repository via Rest API

OomStephan
Champ in-the-making
Champ in-the-making

Good day

Is there a way to retrieve a list all the defined properties and aspects from the Alfresco repository?

Appreciate the help in advance.

Regards

Stephan

1 ACCEPTED ANSWER

Try this REST API if suits your requirements:

GET /alfresco/service/api/dictionary 

http://127.0.0.1:8080/alfresco/service/api/dictionary

GET /alfresco/s/api/defclasses

http://127.0.0.1:8080/alfresco/s/api/defclasses

GET /alfresco/service/api/classes/{className}

http://127.0.0.1:8080/alfresco/service/api/classes/cm_content (type)
http://127.0.0.1:8080/alfresco/service/api/classes/cm_auditable (aspect)

For a specific node:

GET /alfresco/service/api/classes/{classname}/properties?nsp={namespacePrefix?}&n={name?}
GET /alfresco/service/api/properties?nsp={namespacePrefix?}&n={name?}
Example:

http://127.0.0.1:8080/alfresco/service/api/properties?nodeRef=workspace://SpacesStore/1c76d9a6-8d01-...

Visit this doc for more details: https://docs.alfresco.com/5.0/references/RESTful-Dictionary.html

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

View answer in original post

7 REPLIES 7

EddieMay
World-Class Innovator
World-Class Innovator

Hi @OomStephan,

To retrieve aspects, take a look at this API documentation - although this method will depend on how old your Alfresco instance is. For Alfresco 5,2+ the API call will be something like the following:

'http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children?include=aspectNames&skipCount=0&maxItems=100'

For the properties, something like this:

http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children?include=aspectNames,properties&skipCount=0&maxItems=100' 

HTH,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!

OomStephan
Champ in-the-making
Champ in-the-making

Hi Eddie

Thanks for the reply, I am aware of the documentation you linked. However, does this not retrieve the aspects/properties for the specific node?

My use case is that I would like to retrieve all available defined aspects/properties and display them to my user, so that the user can decide what properties he would like to add.

Thanks in advance.

Regards

Stephan

Just to add to the above, is there an endpoint that does not require a nodeId as parameter and instead returns all available aspects and/or properties that can be applied to a node, both system and custom aspects?

Stephan

Try this REST API if suits your requirements:

GET /alfresco/service/api/dictionary 

http://127.0.0.1:8080/alfresco/service/api/dictionary

GET /alfresco/s/api/defclasses

http://127.0.0.1:8080/alfresco/s/api/defclasses

GET /alfresco/service/api/classes/{className}

http://127.0.0.1:8080/alfresco/service/api/classes/cm_content (type)
http://127.0.0.1:8080/alfresco/service/api/classes/cm_auditable (aspect)

For a specific node:

GET /alfresco/service/api/classes/{classname}/properties?nsp={namespacePrefix?}&n={name?}
GET /alfresco/service/api/properties?nsp={namespacePrefix?}&n={name?}
Example:

http://127.0.0.1:8080/alfresco/service/api/properties?nodeRef=workspace://SpacesStore/1c76d9a6-8d01-...

Visit this doc for more details: https://docs.alfresco.com/5.0/references/RESTful-Dictionary.html

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

Exactly what I am looking for. Thank you very much!

Stephan

EddieMay
World-Class Innovator
World-Class Innovator

Hi @OomStephan,

Glad that @abhinavmishra14 was able to help you out & thanks for accepting his solution - really helpful to other users too.

Best wishes, 

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!

EddieMay
World-Class Innovator
World-Class Innovator

Hi @OomStephan,

I presume you've looked at NodeService? There is a discussion here about using it.

HTH,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!