Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Remove customer from ServiceDesk

Eduardo July 2, 2020

Hi, i'm developing a external solution using Jira Service Desk Cloud API and i need to bring the posibility of remove customer totally from JSD (I have configured the project with closed access). If i do it manually on the JSD portal, it's all OK, but if i do it using the JSD Cloud API seems don't do nothing but don't return any Api error, 204 OK Code returned. 

Can you give any help to achieve that funcionality?

 

Thank you very much.

1 answer

0 votes
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 7, 2020

Hello @Eduardo , 

Thanks for reaching out and first off I just wanted to make a referance point for anyone else looking for a similar answer but are on the Server Platform that runs int this thread as this one is currently only avaliable in Jira Cloud,  If you are on Jira Server the Feature is being tracked here:

Next, it sound like you already have this info but as an additional referance point to do this via the API the endpoint you are looking for is going to be:

However, an additional Note is that the Endpoint is currently an Experimental endpoint so you will need to add in a "X-ExperimentalApi: opt-in" header and the endpoint can change without notice, so do be aware of this if you are planning to use this in production.  As an Example the formatting should look like the following using a CURL using either "accountIds" or "usernames" as described in the Documentation above in the Example i used "accountIds" as Both the "accountIds" and the "userNames" options  will take the same account ID as human readable usernames no longer work due to changes implemented for GDPR security to obfuscate usernames as plain text.  :

curl -D- -u EMAIL:API_TOKEN -X DELETE \
--header 'Content-Type: application/json' \
--header 'X-ExperimentalApi: opt-in' \
--URL 'https://{yourdomain}.atlassian.net/rest/servicedeskapi/servicedesk/{serviceDeskId}/customer' \
--data '{
"accountIds": [
"{Insert_Account-ID:here}"
]
}'

As noted in the Documentation the 204 OK will be returned if successful OR if the user listed is not in the particular Service desk, and no action is taken if this is the case:

DELETE /rest/servicedeskapi/servicedesk/{serviceDeskId}/customer

This method removes one or more customers from a service desk. The service desk must have closed access. If any of the passed customers are not associated with the service desk, no changes will be made for those customers and the resource returns a 204 success code.

 So I would suggest double-checking the account id's that you are inputing and you can do so via the Get customers API endpoint, noting that this one is currently Experimental as well and requires the additional header noted above:

And one caveat to this one that may be the issue you are encountering is that the accountID value that is returned in this GET, currently will return any colon character ":" with the "%3A" encoding but it needs to be converted back to a ":" for use in the DELETE call.

Please check this out and let me know what you find.

Regards,
Earl

Eduardo July 13, 2020

Hi Earl!,

Thanks for the response but i still having the same problem after doubleCheck the account Id, i'll share some screenshots for more info, in order:

- Customer AccountId : qm:cd6c75ae-de78-46af-8ed1-d50651f34c2f:99ef7185-a5af-48ad-a101-ee25c35c4ed6

- Delete customer request header

- Delete customer request body

- Request Result 

- Customer still appears on the serviceDesk

Screenshot_1.pngScreenshot_3.pngScreenshot_2.pngScreenshot_4.png

Screenshot_5a.png

Eduardo July 21, 2020

hi Earl!,,

Can you give me some update on that question?

Thank you so much.

Like Levan Gogoladze likes this
Levan Gogoladze July 21, 2020

I am experiencing the same issue right now.

Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 22, 2020

Hello @Eduardo and @Levan Gogoladze ,

Thank you for all the details and I have been digging into this a bit and I too ran into the same issue with the endpoint as you and it randomly stopped accepting the delete call and simply returned a 204 and keep the user that was supposed to be removed. 

We are still working on tracking down the exact cause, noting the endpoint is still Experimental so it does have a few issues to work out and is in constant development and a recent update to the structure may have caused this hiccup, but again we are still tracking down the root cause and we do not have a definitive answer at this point.

Initially the endpoint was working fine with the formatting I noted above, but after your reply I tested again and it had stoped working for me using the same syntax as the previous tests.

Ultimately, it looks like something is getting hung up in the way the endpoint is passing the user accountIds in caching on the backend and we were able to get it knocked loose and working again by adding a new internal test user account as a Global admin as well as a Project Admin to the service desk project, then have that new user run the same call with the noted syntax above, and it worked for the new user, once we then removed the new test user from the Service desk project admin permission it started working for the original admin account again with no change to the syntax, and has not failed again since this process was applied.

Can you run a test with a new temporary admin account to see if you get the same results and let me know what you find to see if this workaround will act as a stop gap for you while we track down the issue causing the block to occur?

Regards,
Earl

Gerben Heinen
Contributor
October 24, 2023

Hi, i am looking for a way to remove the customer role from a user for jira service management in the administration section of cloud. Is there an API endpoint to do that?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events