Hello everyone.
I'm trying to delete a user from request participants via res api.
i found this:
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!
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
Cheers,
Dario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.