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

Create tasks using REST API

Hi all,

I'm trying to create tasks in R language using REST API for Jira.

This issue don't relate to the using POST call in R, but overall URL link for crearing issue  which could be used also in web browser.

I manage to fill basic mandatory fields, but I have issue selecting specific option from the list of options of custom fields.

Link for creating user story is following:

https://*domain+jira*/secure/CreateIssueDetails!init.jspa?pid=14500&issuetype=11001&summary=say+hello+world&customfield_10200=245&customfield_10201=30

 I get only error about missing mandatory fields

customfield_10200: Account is required.

customfield_10201: Team is required.

Did I miss something in the specification of custom field option?

Thank you for the support

3 answers

2 accepted

1 vote
Answer accepted

Hi @Lukaš Koribsky , welcome on the community. I can see you want to "create issue from browser" but you can simply invoke only GET request in browser (I think it is what you want), but you are trying to use action CreateIssueDetails which can handle only POST request. Also native Jira REST API for issue creation uses POST request (https://docs.atlassian.com/software/jira/docs/api/REST/8.13.2/#api/2/issue-createIssue).

I think you can still create issue via GET request but you would need to implement simple endpoint which will accept GET request.

Hi @Martin Bayer _MoroSystems_ s_r_o__  thank you. I understand what do you mean. I didnt already try to fill fields through JSON. I found somewhere that sending POST request with CreateIssueDetails structure is also possible way to create issues.

Now I will focus only to generate it through POST (according to the documentation which doy reference to me)

Thank you

0 votes
Answer accepted

Hi!

Could you check your request via postman, please?

Also, you can find some info from dev tools from your browser. If you creat test ticket you can find the exact POST request.

Hi again,

so I checked structure of task which were already created in my team, and according that I created following JSON:

{
"fields": {
"project":
{
"id": "14400"
},
"summary": "TEST US",
"description": "Creating of an issue using IDs for projects and issue types using the REST API",
"issuetype": {
"id": "10001"
},
"customfield_11400": {
"self": "https://*JIRA+domain*/rest/api/2/customFieldOption/13703",
"value": "Standard",
"id": "13703"
},
"customfield_10201": "30",
"customfield_10200": {
"self": "https://*JIRA+domain*/rest/tempo-accounts/1/account/245",
"id": "245",
"key": "TESTPROJEC",
"name": "Test project"
}
}
}

Using POST call:

post <- httr::POST( "https://*JIRA+domain*//rest/api/2/issue"
, body = toJSON(list(body = test), auto_unbox = T)
, content_type_json()
, authenticate(user, password))

But I get only 404.

 

Is there any way, how can I find out what exactly is wrong? Or my JSON is wrong?

customfield_11400, customfield_10200, customfield_10201 are mandatory fields.

Thank you for the support.

@Lukaš Koribsky try to change endpoint to 

https://*JIRA+domain*/rest/api/3/issue

@Martin Bayer _MoroSystems_ s_r_o__  sorry for late response. I tried that, but it returns HTTP 404 with message about dead link.

I have a question: if I try to put 

https://*JIRA+domain*/rest/api/2/issue

 to web browser, it okay/expected to receive this:

restApi.PNG

I dont have experience with REST API, that on the background will process some functionality for creating something, but I was expecting maybe something different.

Thank you for the support

Hi @Lukaš Koribsky , you need to replace 

*JIRA+domain*

with a value relevant for you... probably something like "yourcompany.atlassian.net".

Hi @Martin Bayer _MoroSystems_ s_r_o__ yes, this was correct.

Anyway, the issue was only and only in the json. For the specific custom_field I have to send only ID of value. No label of value, or anything else, just ID.

Anyway Thank you all for support

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Announcing the waitlist for Jira Work Management

Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...

636 views 10 16
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