Delete participant rest api jira cloud

Josep Maria Cao October 24, 2019

Hello everyone.

I'm trying to delete a user from request participants via res api.

i found this:

https://developer.atlassian.com/cloud/jira/service-desk/rest/#api-rest-servicedeskapi-request-issueIdOrKey-participant-delete

and is the same as the add participant but changing post to delete.

My code is:

def requestParticipantsSD = "customfield_10023"

def userSD = issueToUpdate.fields[requestParticipantsSD].accountId

userSD.each { user ->

def bodyData = '{"accountIds": ["'+user+'"]}';

def resp = delete("rest/servicedeskapi/request/"+issuekey+"/participant")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.body(bodyData).asJson()
}

and is returning me an error 500: No content to map due to end-of-input

 

im doing the same but changing delete to post, and returns 200 and the participant is added.

Any ideas?

Thanks you!

1 answer

0 votes
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 25, 2019

Hi @Josep Maria Cao ,

If my understanding is correct you are able to add a request participant using the JSD REST API endpoint /rest/servicedeskapi/request/{issueIdOrKey}/participant but you cannot remove them.

If my understanding is correct, then you might be facing the below bug:

Can you kindly review it and check if that's the same issue you are facing? 

If it is the same issue, you may want to vote and watch the above bug ticket so that you will be notified in case of any progress.

If this is a different issue then I would advise to check if you are able to run the same request using Curl. This way you can determine whether the issue is with your code or with the endpoint itself.

In case the Curl request will fail can please add the -D- flag to the command so that it will print the whole response header and paste the output of the command in your reply (making sure to remove all the sensitive data from there).

 

Cheers,
Dario

Josep Maria Cao October 28, 2019

Hello,

thanks for your time, but my question is, if my code is working with POST method to add a new user in request participant and your info to do this is change POST to DELETE, and is not working, why do you think my code is wrong?

This is working:

def resp = post("rest/servicedeskapi/request/"+issuekey+"/participant")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.body(bodyData).asJson()

the full error is:

2019-10-28 13:42:21.306 WARN - DELETE request to rest/servicedeskapi/request/HD-65/participant returned an error code: status: 500 - Server Error (530) (proxy status: 530)
body: {"status-code":500,"stack-trace":"java.io.EOFException: No content to map to Object due to end of input\n\tat org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2775)\n\tat org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2691)\n\tat org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1315)\n\tat org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:419)\n\tat com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:490)\n\tat com.sun.jersey.spi.container.AdaptingContainerRequest.getEntity(AdaptingContainerRequest.java:236)\n\tat com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$EntityInjectable.getValue(EntityParamDispatchProvider.java:123)\n\tat com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:86)\n\tat com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$EntityParamInInvoker.getParams(DispatchProviderHelper.java:191)\n\tat com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$ResponseOutInvoker._dispatch(DispatchProviderHelper.java:250)\n\tat com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)\n\tat com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)\n\tat com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)\n\tat com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)\n\tat com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)\n\tat com.sun.jersey.server.impl.applicat

 Thank you

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 29, 2019

Hello @Josep Maria Cao ,

At this current point in time I don't have enough information to be in the position to make the assumption that your code might be wrong.  Therefore, I am asking you to test some things in order to try narrow down this issue.

I have already tried to reproduce the issue on my side using Curl and everything works fine for me. Please see the output below:

curl -D- -u <USERNAME>:<PASSWORD> -H "Accept: application/json" -H "Content-Type: application/json" -d  '{"accountIds": ["qm:c170xxxxxxxxxxxxxxxxxxxx"]}' -X DELETE https://<SITE>.atlassian.net/rest/servicedeskapi/request/CSP-14/participant/
 

HTTP/2 200 
server: AtlassianProxy/1.15.8.1
vary: Accept-Encoding
[REMOVED]
 

{"size":0,"start":0,"limit":50,"isLastPage":true,"_links":{"self":"https://SITE.atlassian.net/rest/servicedeskapi/request/CSP-14/participant/","base":"https://SITE.atlassian.net","context":""},"values":[]}

 

So, since I cannot reproduce the issue, I need you to verify:

  1. If you are facing the bug tracked as [JSDCLOUD-5033] Unable to remove request participant via REST API when reporter is on the list
  2. What happens if you try to run the same request using Curl as I did above. I need to see the beginning of the header as well as the error message returned by Jira Cloud
  3. (added) Looking at the provided stacktrace I can see a proxy status: 530 error returned. Do you actually use a company proxy or similar? Can you try to run the same code from a machine that do not use a proxy or from a different network and let me know if this works?

 

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer