You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
I am using Jira Rest API to create issues. I need to set a reporter for each issue using rest API.
Below is the body parameter which I am creating to use in the API
json_object = {"fields":{"project":{"key":"IM"},"reporter": { "name": "Gloria Laureano" },"summary":"Testing Jira Data","description":"this is the test jira issue testing","issuetype":{"name":"Client Implementation"}}};
Below is my code to create issue using rest API
headers.put("Content-Type","application/json");
headers.put("Authorization","Basic c2hyYWRkaGFAY3JtLW1hc3RlcnMuY29tOmRPaVN1eGtkZmVtUG85TnY5YUZGMUEzMA==");
json_object = {"fields":{"project":{"key":"IM"},"reporter": { "name": "Gloria Laureano" },"summary":"Testing Jira Data","description":"this is the test jira issue testing","issuetype":{"name":"Client Implementation"}}};
jiradata = invokeurl
[
url :"https://b2bsoft.atlassian.net/rest/api/2/issue"
type :POST
parameters:json_object.toString()
headers:headers
];
But I am getting error while hitting this. the error which I am getting is
{"errorMessages":[],"errors":{"reporter":"Field 'reporter' cannot be set. It is not on the appropriate screen, or unknown."}}.
I am not able to understand what I am doing wrong. So please help me how to set the reporter using API.
Hi @Shraddha Jaiswal and welcome to the community,
Why are you using rest/2 when there is rest/3?
Use this http request and set the reporter from the beginning:
POST /rest/api/3/issue
Add this below your "fields", while changing the id with the one you want:
"reporter": { "id": "5b10a2844c20165700ede21g" }
How I will get the reporter ID?
I am using JIRA REST API under the ZOHO CRM script. So the ZOHO USERS will be the reporter on JIRA.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You have to know each user's id separately from Jira. If you go to your Jira and go to a user, you will see his/her id on the browser url with a format like
5b10a2844c20165700ede21g
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there any Jira API to get the user's Id? As I am using API to create the issue on JIRA.
Please help me to get the API as I am stuck to get the user id.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This maybe
I'm not aware of an endpoint to get the reporter/assignee ID per se. I mean if you query an issue with an API request, its payload would be something like the following:
"reporter": {
"self": "https://koxaras.atlassian.net/rest/api/3/user?accountId=7f9fb1f1c2e53906667adf321",
"accountId": "7f9fb1f1c2e53906667adf321",
"emailAddress": "akoxaras@cententia.com",
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am using the Authorization Code Flow to generate an Access token and refresh token.
Firstly I am sending the authorization URL:
https://YOUR_DOMAIN/authorize? response_type=code& client_id=YOUR_CLIENT_ID& redirect_uri=https://YOUR_APP/callback& scope={scope}& audience={apiAudience}& state={state}
From the above URL response, I am getting the Authorization Code.
Next, I need to POST the Token URL which is
curl --request POST \ --url 'https://YOUR_DOMAIN/oauth/token' \ --header 'content-type: application/x-www-form-urlencoded' \ --data grant_type=authorization_code \ --data 'client_id=YOUR_CLIENT_ID' \ --data 'client_secret={yourClientSecret}' \ --data 'code=yourAuthorizationCode}' \ --data 'redirect_uri=https://YOUR_APP/callback'
I am getting a response with a payload containing access_token
, expires_in, scope, and token_type
values:
{
"access_token": "eyJz93a...k4laUWw",
"expires_in": 3600,
"token_type": "Bearer",
"scope": "delete:issue:jira write:issue-link-type:jira read:project:jira read:project-category:jira write:project-category:jira write:issue-type:jira write:issue:jira read:account write:issue-link:jira delete:project-category:jira delete:issue-link-type:jira read:issue-type:jira read:issue:jira read:me delete:issue-link:jira delete:issue-type:jira write:project:jira read:issue-link-type:jira read:issue-link:jira delete:project:jira"
}
But I want a refresh token also. I need to use a refresh token to get another access token and refresh token pair.
So, Please guide me how I can get the refresh token also.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could try the call /rest/api/2/issue/createmeta
This will show you all the fields that Jira will accept when creating a ticket via REST API. I would definitely expect reporter to be in there.
Check the user calling the REST API has Modify Reporter permissions on the target project.
If those steps aren't the solution. Try ensuring the Reporter is on the create, edit screens.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Tom Lister Hi, how can I know the reporter I'm setting is on the edit/create screens ? Like do I need to give that user the permission whom I'm going to be selected as a reporter ?
Or do I need to provide permission to the user whose API keys I'm using while setting other reporters ?
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.