I can create, update, query, etc a Person. But no DELETE? Why? I've been Googling and can't find a mention of this anywhere. Using community v6.2.
I think there is no V1 api to delete person or at least it is not document in dcumentation if there is even any.
However, you can use Person Update V1 api to disable the user as a workaround. If users are synced from AD, it is recommended to disable the user instead of deleting it.
https://docs.alfresco.com/6.2/concepts/dev-api-by-language-alf-rest-manage-people-groups-update-person.html
If you still need to delete the user, use the Repository api: https://docs.alfresco.com/5.0/references/RESTful-PersonPersonDelete.html
Example:
HTTP DELETE Request: http://localhost:8080/alfresco/service/api/people/testUser
Note that, only users with admin role can create/update/delete users and groups.
Hello,I need to delete user anyway, I tried via interface but there is an error,so , i tried via API indicate in this forum, but i have another error message.Error via interface :
"message" : "07260136 Wrapped Exception (with status template): 07260803 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/repository/person/person.delete.js': Node does not exist: workspace:/\/SpacesStore\/561b834d-4f27-4bb2-aaee-9e700c7d5c4a (status:Status[id=1255changeTxnId=7668b62b-6c3f-45d7-94b4-cf315cff4709, dbTxnId=138, deleted=true])"
Error via API :
{ "status": { "code": 500, "name": "Internal Error", "description": "An error inside the HTTP server which prevented it from fulfilling the request." }, "message": "07260177 Wrapped Exception (with status template): 07260897 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/repository/person/person.delete.js': Node does not exist: workspace://SpacesStore/561b834d-4f27-4bb2-aaee-9e700c7d5c4a (status:Status[id=1255changeTxnId=7668b62b-6c3f-45d7-94b4-cf315cff4709, dbTxnId=138, deleted=true])", "exception": "", "callstack": [], "server": "Community v7.0.0 (rdf924796-blocal) schema 14,002", "time": "Aug 26, 2021, 2:23:30 PM" }
I also tried via admin-nodebrowser and have this error message : 13:45:30 - 07260881 beforeDeleteNode: use PersonService to delete personHave you any idea to correct it ?Thanks!
@PierreP As mentioned above there are no ootb V1 api for delete person. Repo api should still work though.
DELETE http://localhost:8080/alfresco/service/api/people/{USERName}
Example http delete method for delete person:
http://localhost:8080/alfresco/service/api/people/test2
Make sure you provide the correct username you want to delete.
You can also write a custom webscript to delete the person if at all required with PersonService
https://github.com/Alfresco/alfresco-community-repo/blob/master/repository/src/main/java/org/alfresco/service/cmr/security/PersonService.java#L244
Thanks @abhinavmishra14 for your response,I use the api like you say, the username is linked to the "id" column in alfresco right ? (in our case, it's the email address)my call :
curl --location --request DELETE 'https://alfresco-beta.xxx.local/alfresco/service/api/people/aze@aze.fr' \ --header 'Authorization: Basic (not in the web but it's admin:password)'
have you got some clues to write a web script ?(because in interface i have an error when i want use javascript console if it is the way to do that (cf screenshot))
Thanks, Pierre