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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Can we add a customer in an existing Jira Service Desk Project via a Rest API call?

Hi,

Can we add a customer in an existing Jira Service Desk Project via a Rest API call?

1 answer

1 accepted

1 vote
Answer accepted
Dirk Ronsmans Community Leader Sep 04, 2020

Hi @Stakater SRE _ 1  and welcome to the community,

I have not done it myself but I'm pretty sure you can.

This entry in the api documentation explains as such

Create Customer 

Create customer

POST /rest/servicedeskapi/customer

This method adds a customer to the Jira Service Desk instance by passing a JSON file including an email address and display name. The display name does not need to be unique. The record's identifiers, name and key, are automatically generated from the request details.

It would atleast allow you to create the customer as step 1

If the customer then exists a 2nd call to add the customer to the SD would be:

Add Customer to JSD Project 

Add customers

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

Adds one or more customers to a service desk. If any of the passed customers are associated with the service desk, no changes will be made for those customers and the resource returns a 204 success code.

We can create customers with the Create Customers api call which you mentioned but can we delete them too? Or if we want to verify that the customer already exists, is there a relevant Get api call. Can't find the support of this in the api docs.

Dirk Ronsmans Community Leader Sep 08, 2020

Actually the link below add customers :)

Delete Customers 

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.

Permissions required: Services desk administrator

 

As for "getting" it seems you can not search for a specific customer but you can get a list of all customers added to the project.

Get Customers 

There you could parse the list to see if the user you need is in there.

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

This method returns a list of the customers on a service desk.

The returned list of customers can be filtered using the query parameter. The parameter is matched against customers' displayName, name, or email. For example, searching for "John", "Jo", "Smi", or "Smith" will match a user with display name "John Smith".

Permissions required: Permission to view this Service Desk's customers.

 

All the other actions are availble on: https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-servicedesk/#api-group-servicedesk

I think you misunderstood the question :-)

Creating customers and adding customers to the projects are two separate things. As you mentioned in your first answer that in order to add customer to the project, we have to make two api calls. First to create the customer and than to add the created customer to the project. Similarly the api provides support to remove that customer from the project as well. Buy my question is that can we completely delete the created customers?

The below scenario may help you understand the problem.

For example: We create a customer, we add him into two projects. Now, the api provides us the support to remove the customer from either project. But can we completely delete that customer so that it get simultaneously removed from both projects? I don't find the api support for that.

Dirk Ronsmans Community Leader Sep 09, 2020

I see, I indeed took "delete" as just remove them from the servicedesk (as you delete them from your customers there).

From what I can see then you would want to remove the "Portal Only Customers"

When I remove those manually they are indeed also removed from all projects. This might however not work if this person has an Atlassian Account on that email address as those are then managed by Atlassian and not on your own environment.

To remove those I couldn't seem to find any API myself either so I suggest directing that question to Atlassian Support.

 

I still feel that removing them from all JSD projects would a nice workaround as they would also no longer have access. If you are afraid of someone re-adding them then it doesn't matter whether you remove them and they re-invite them or if they just re-add them.  But I understand that it would mean a quicker process to just remove the account and take all the access/customer entries with it.

Sadly I don't see an option for that at the moment.

Like Dirk Ronsmans likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Jira Service Management

Why upgrade to Jira Service Management Premium?

We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan.  &nb...

165 views 0 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you