Hello,
how to assign my user as assignee with a function?
'{ "fields": { "project": { "key": "AUTOMAT" }, "summary": "REST ye merry gentlemen.", "assignee":{"name":currentUser()} , "description": "Creating of an issue using project keys and issue type names using the REST API", "issuetype": { "name": "Aufgabe" } } } '
error:
400 : {"errorMessages":["Unexpected character ('c' (code 99)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.apache.catalina.connector.CoyoteInputStream@b4699d9; line: 1, column: 111]"]}
thanks
Andreas
Hi, @Andreas Wohlmuth
If I understood right, you're using REST API to set assignee.
You need to use username, as value for "name". But you're trying to use currentUser() which is internal function of Jira, and returns user as whole object.
I'd check currentUser().username but I'm not sure that it'll work. It needs to be tested
From where do you trigger this web request? Groovy script? Automation?
Ex script to get currentUser:
import com.atlassian.jira.component.ComponentAccessor
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
After getting the user object, you can provide required attribute as a parameter (considering escape characters) to JSON.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Evgeniy,
thanks for hint currentUser().username
Hi, Tansu,
I am using Delphi to connect and will check Delphi lib for similar getJiraAuthenticationContext
client_post := TRESTClient.Create(nil);
....
body_s:= text.Text.Replace(''#$D#$A'','\n') ;
request_post.Method := TRESTRequestMethod.rmPost;
request_post.Resource := '/rest/api/2/issue';
request_post.AddBody(body_s, ctAPPLICATION_JSON);
request_post.Execute;
many thanks for help
Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.