<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: REST API - delete Person in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/rest-api-delete-person/m-p/100371#M28968</link>
    <description>&lt;P&gt;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/87345"&gt;@PierreP&lt;/A&gt;&amp;nbsp;As mentioned above there are no ootb V1 api for delete person. Repo api should still work though.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;DELETE&lt;/STRONG&gt;&amp;nbsp;&lt;SPAN&gt;&lt;A href="http://localhost:8080/alfresco/service/" target="_blank" rel="nofollow noopener noreferrer"&gt;http://localhost:8080/alfresco/service/&lt;/A&gt;&lt;STRONG&gt;api/people/&lt;/STRONG&gt;{&lt;STRONG&gt;USERName&lt;/STRONG&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;U&gt;Example http delete method for delete person&lt;/U&gt;:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://localhost:8080/alfresco/service/api/people/" target="_blank" rel="nofollow noopener noreferrer"&gt;http://localhost:8080/alfresco/service/api/people/&lt;/A&gt;&lt;STRONG&gt;test2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Make sure you provide the correct username you want to delete.&lt;/P&gt;
&lt;P&gt;You can also write a custom webscript to delete the person if at all required with PersonService&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/Alfresco/alfresco-community-repo/blob/master/repository/src/main/java/org/alfresco/service/cmr/security/PersonService.java#L244" target="_blank" rel="nofollow noopener noreferrer"&gt;https://github.com/Alfresco/alfresco-community-repo/blob/master/repository/src/main/java/org/alfresco/service/cmr/security/PersonService.java#L244&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 31 Aug 2021 17:56:35 GMT</pubDate>
    <dc:creator>abhinavmishra14</dc:creator>
    <dc:date>2021-08-31T17:56:35Z</dc:date>
    <item>
      <title>REST API - delete Person</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/rest-api-delete-person/m-p/100368#M28965</link>
      <description>&lt;P&gt;I can create, update, query, etc a Person.&amp;nbsp; &amp;nbsp;But no DELETE?&amp;nbsp; Why?&amp;nbsp; I've been Googling and can't find a mention of this anywhere. Using community v6.2.&lt;/P&gt;</description>
      <pubDate>Sat, 31 Oct 2020 01:23:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/rest-api-delete-person/m-p/100368#M28965</guid>
      <dc:creator>ibodog</dc:creator>
      <dc:date>2020-10-31T01:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - delete Person</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/rest-api-delete-person/m-p/100369#M28966</link>
      <description>&lt;P&gt;I&amp;nbsp;think there is no V1 api to delete person or at least it is not document in dcumentation if there is even any.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.alfresco.com/6.2/concepts/dev-api-by-language-alf-rest-manage-people-groups-update-person.html" target="_blank" rel="noopener nofollow noreferrer"&gt;https://docs.alfresco.com/6.2/concepts/dev-api-by-language-alf-rest-manage-people-groups-update-person.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If you still need to delete the user, use the&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;Repository api:&amp;nbsp;&lt;A href="https://docs.alfresco.com/5.0/references/RESTful-PersonPersonDelete.html" target="_blank" rel="noopener nofollow noreferrer"&gt;https://docs.alfresco.com/5.0/references/RESTful-PersonPersonDelete.html&lt;/A&gt;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;DIV class="abstract"&gt;&lt;SPAN class="shortdesc"&gt;Delete a person.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="section refsyn"&gt;&lt;A href="http://localhost:8080/alfresco/service/description/org/alfresco/repository/person/people.post" target="_blank" rel="noopener nofollow noreferrer"&gt;&lt;SAMP class="ph codeph"&gt;DELETE /alfresco/service/api/people/{userName}&lt;/SAMP&gt;&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV class="section refsyn"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="section refsyn"&gt;The web script description document specifies the following options:&lt;/DIV&gt;
&lt;DIV class="section refsyn"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;TABLE class="simpletable properties" border="1" summary="" cellspacing="0" cellpadding="4"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH id="d496345e97-value" align="left" valign="bottom"&gt;Value&lt;/TH&gt;
&lt;TH id="d496345e97-desc" align="left" valign="bottom"&gt;Description&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR class="strow property"&gt;
&lt;TD valign="top" class="stentry propvalue"&gt;&lt;SAMP class="ph codeph"&gt;json&lt;/SAMP&gt;&lt;/TD&gt;
&lt;TD valign="top" class="stentry propdesc"&gt;The default response format&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR class="strow property"&gt;
&lt;TD valign="top" class="stentry propvalue"&gt;&lt;SAMP class="ph codeph"&gt;admin&lt;/SAMP&gt;&lt;/TD&gt;
&lt;TD valign="top" class="stentry propdesc"&gt;The authentication access&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR class="strow property"&gt;
&lt;TD valign="top" class="stentry propvalue"&gt;&lt;SAMP class="ph codeph"&gt;required&lt;/SAMP&gt;&lt;/TD&gt;
&lt;TD valign="top" class="stentry propdesc"&gt;The transaction level&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR class="strow property"&gt;
&lt;TD valign="top" class="stentry propvalue"&gt;&lt;SAMP class="ph codeph"&gt;argument&lt;/SAMP&gt;&lt;/TD&gt;
&lt;TD valign="top" class="stentry propdesc"&gt;The format style&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;

&lt;P&gt;&lt;U&gt;Example:&lt;/U&gt;&lt;/P&gt;
&lt;PRE&gt;HTTP DELETE Request:

http://localhost:8080/alfresco/service/api/people/testUser
&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Note that, only users with admin role can create/update/delete users and groups.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Oct 2020 18:01:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/rest-api-delete-person/m-p/100369#M28966</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2020-10-31T18:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - delete Person</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/rest-api-delete-person/m-p/100370#M28967</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I need to delete user anyway, I tried via interface but there is an error,&lt;BR /&gt;so , i tried via API indicate in this forum, but i have another error message.&lt;BR /&gt;&lt;BR /&gt;Error via interface :&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;  "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])"&lt;/PRE&gt;&lt;P&gt;Error via API :&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;{
    "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"
}&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I also tried via admin-nodebrowser&amp;nbsp;&lt;BR /&gt;and have this error message :&amp;nbsp;&lt;SPAN&gt;13:45:30 - 07260881 beforeDeleteNode: use PersonService to delete person&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Have you any idea to correct it ?&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 14:25:03 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/rest-api-delete-person/m-p/100370#M28967</guid>
      <dc:creator>PierreP</dc:creator>
      <dc:date>2021-08-26T14:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - delete Person</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/rest-api-delete-person/m-p/100371#M28968</link>
      <description>&lt;P&gt;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/87345"&gt;@PierreP&lt;/A&gt;&amp;nbsp;As mentioned above there are no ootb V1 api for delete person. Repo api should still work though.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;DELETE&lt;/STRONG&gt;&amp;nbsp;&lt;SPAN&gt;&lt;A href="http://localhost:8080/alfresco/service/" target="_blank" rel="nofollow noopener noreferrer"&gt;http://localhost:8080/alfresco/service/&lt;/A&gt;&lt;STRONG&gt;api/people/&lt;/STRONG&gt;{&lt;STRONG&gt;USERName&lt;/STRONG&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;U&gt;Example http delete method for delete person&lt;/U&gt;:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://localhost:8080/alfresco/service/api/people/" target="_blank" rel="nofollow noopener noreferrer"&gt;http://localhost:8080/alfresco/service/api/people/&lt;/A&gt;&lt;STRONG&gt;test2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Make sure you provide the correct username you want to delete.&lt;/P&gt;
&lt;P&gt;You can also write a custom webscript to delete the person if at all required with PersonService&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/Alfresco/alfresco-community-repo/blob/master/repository/src/main/java/org/alfresco/service/cmr/security/PersonService.java#L244" target="_blank" rel="nofollow noopener noreferrer"&gt;https://github.com/Alfresco/alfresco-community-repo/blob/master/repository/src/main/java/org/alfresco/service/cmr/security/PersonService.java#L244&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 17:56:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/rest-api-delete-person/m-p/100371#M28968</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2021-08-31T17:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - delete Person</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/rest-api-delete-person/m-p/100372#M28969</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/74498"&gt;@abhinavmishra14&lt;/A&gt;&amp;nbsp;for your response,&lt;BR /&gt;&lt;BR /&gt;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)&lt;BR /&gt;my call :&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;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)'&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;have you got some clues to write a web script ?&lt;BR /&gt;(because in interface i have an error when i want use javascript console if it is the way to do that (cf screenshot))&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="al.PNG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/901i88F535D27B133C72/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks,&amp;nbsp;&lt;BR /&gt;Pierre&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 06:21:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/rest-api-delete-person/m-p/100372#M28969</guid>
      <dc:creator>PierreP</dc:creator>
      <dc:date>2021-09-01T06:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - delete Person</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/rest-api-delete-person/m-p/100373#M28970</link>
      <description>&lt;P&gt;That's strage. It should work irrespective of email unless email is used as username/userId.&lt;/P&gt;
&lt;P&gt;This both requests worked fine for a test i did:&lt;/P&gt;
&lt;PRE&gt;curl -X DELETE -H "Authorization: Basic VElDS0VUXzYxYmIwMmM3Y2I3NzQxOTM2MWM1YzY3ZWViY2RmODdiMDcyMDVmMjU=" http://localhost:8080/alfresco/service/api/people/&lt;STRONG&gt;test2&lt;/STRONG&gt;&lt;/PRE&gt;
&lt;PRE&gt;curl -X DELETE -H "Authorization: Basic VElDS0VUXzYxYmIwMmM3Y2I3NzQxOTM2MWM1YzY3ZWViY2RmODdiMDcyMDVmMjU=" http://localhost:8080/alfresco/service/api/people/&lt;STRONG&gt;test@alfresco.com&lt;/STRONG&gt;&lt;/PRE&gt;
&lt;P&gt;Are you getting the error for specific user or all users? Can you try any other users? Try creating a test user and see what you get ? Are these users synced from ldap/ad?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are getting the error with default api, likely you would get same with any custom webscript as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can learn writing webscript from here:&amp;nbsp;&lt;A href="http://ecmarchitect.com/alfresco-developer-series-tutorials/webscripts/tutorial/tutorial.html" target="_blank" rel="noopener nofollow noreferrer"&gt;http://ecmarchitect.com/alfresco-developer-series-tutorials/webscripts/tutorial/tutorial.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Here is an example if this helps:&lt;/P&gt;
&lt;PRE&gt;public class DeleteUserWebscript extends AbstractWebScript {

	private static final Logger LOGGER = LoggerFactory.getLogger(DeleteUserWebscript.class);

	private final PersonService personService;

	public DeleteUserWebscript(final ServiceRegistry serviceRegistry) {
		super();
		this.personService = serviceRegistry.getPersonService();
	}

	@Override
	public void execute(final WebScriptRequest req, final WebScriptResponse res) throws IOException {
	      final String userName = req.getParameter("username");
    	      LOGGER.info("Deleting user: {}", userName);
    	  try {
    		if (personService.personExists(userName)) {
    			personService.deletePerson(userName);
    			res.getWriter().write(String.format("User %s has been deleted successfully!", userName));
    		} else {
    			final String errorMsg = String.format("User %s can not be found, unable to delete the user!", userName);
    	    	        LOGGER.info(errorMsg);
    			res.getWriter().write(errorMsg);
    			res.setStatus(404);
    		}
	    } catch (AuthenticationException authex) {
			LOGGER.error("Failed to authenticate user", authex);
			res.getWriter().write(String.format("Failed to delete the user %s due to: %s. Please contact administrator!", userName, authex.getMessage()));
		        res.setStatus(401);&lt;BR /&gt;            } catch (AlfrescoRuntimeException excp) {
			LOGGER.error("Error while deleting the user", excp);
			res.getWriter().write(String.format("Failed to delete the user %s due to: %s. Please contact administrator!", userName, excp.getMessage()));
		        res.setStatus(500);&lt;BR /&gt;             }
	}	
}&lt;/PRE&gt;
&lt;PRE&gt;&amp;lt;webscript&amp;gt;
  &amp;lt;shortname&amp;gt;Delete User&amp;lt;/shortname&amp;gt;
  &amp;lt;description&amp;gt;&amp;lt;/description&amp;gt;
  &amp;lt;url&amp;gt;/support-admin/delete-user?username={username}&amp;lt;/url&amp;gt;
  &amp;lt;authentication&amp;gt;admin&amp;lt;/authentication&amp;gt;
  &amp;lt;family&amp;gt;ADMIN_UTILS&amp;lt;/family&amp;gt;
&amp;lt;/webscript&amp;gt;&lt;/PRE&gt;
&lt;PRE&gt;&amp;lt;bean id="webscript.com.demo.admin.delete-user.delete"
		class="com.demo.admin.webscript.DeleteUserWebscript"
		parent="webscript"&amp;gt;
   &amp;lt;constructor-arg ref="ServiceRegistry"/&amp;gt;
&amp;lt;/bean&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Sep 2021 19:28:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/rest-api-delete-person/m-p/100373#M28970</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2021-09-01T19:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - delete Person</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/rest-api-delete-person/m-p/100374#M28971</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;Thanks again for your help&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/74498"&gt;@abhinavmishra14&lt;/A&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;I tried with all user of my instance of Alfresco and i get the same error ...&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks for your documentation of webscript, i will try this even if you said maybe it don't works.&lt;BR /&gt;&lt;BR /&gt;If it's don't work again, i think i will wait an update of Alfresco, and just desactivate user (even if it's not really clean).&lt;BR /&gt;&lt;BR /&gt;Pierre.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 07:41:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/rest-api-delete-person/m-p/100374#M28971</guid>
      <dc:creator>PierreP</dc:creator>
      <dc:date>2021-09-02T07:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - delete Person</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/rest-api-delete-person/m-p/100375#M28972</link>
      <description>&lt;P&gt;Ideally we deactivate the users in production systems instead of deleting them. Usually delete api causes issues with users synced from outside of the repository such as ldap/ad. I am not sure about your case though. From what i could recall, when you sync users from ladp/ad, there is property called "isMutable" is set to false which means that user cannot be deleted.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also use this api :&amp;nbsp;&lt;A href="http://127.0.0.1:8080/alfresco/service/api/people/test@alfresco.com" target="_blank" rel="noopener nofollow noreferrer"&gt;http://127.0.0.1:8080/alfresco/service/api/people/&amp;lt;userName&amp;gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;and see what you get for your users which are not getting deleted. Its just another debug step.&lt;/P&gt;
&lt;P&gt;e.g.: &lt;A href="http://127.0.0.1:8080/alfresco/service/api/people/test@alfresco.com" target="_blank" rel="nofollow noopener noreferrer"&gt;http://127.0.0.1:8080/alfresco/service/api/people/test@alfresco.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 13:14:38 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/rest-api-delete-person/m-p/100375#M28972</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2021-09-02T13:14:38Z</dc:date>
    </item>
  </channel>
</rss>

