Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

how can i attach a document to an issue with REST API at issue creation time?

kiran July 31, 2014

hi,

how can i attach a document to an issue with REST API at issue creation time?

without using CURL command , cann't we upload the attachement to JIRA issue using the REST ?

because lot of documents are suggested to go for curl command, but i need to use it from REST API itself.

can anyone help me here!!

Thanks in advance

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Ravi Sagar _Sparxsys_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 1, 2014

Hi Kiran,

I believe you are trying to create an issue and also attachment using REST Api. What is the the language you are using to write this? You will find lot of examples written in PHP.

Refer to this document for all the REST definitions: https://docs.atlassian.com/jira/REST/latest/

This link has some good examples: https://developer.atlassian.com/display/JIRADEV/JIRA+REST+APIs#JIRARESTAPIs-ASimpleExample:CreatinganIssueinJIRA

Regards,

Ravi

0 votes
Tiago Comasseto
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 31, 2014

Hi Kiran, as far as I know you can't create issues via REST and attach files at the same time. It requires two REST calls. You can see more details here

As for not using CURL and REST API itself, I'm not sure if I understood it right, but I believe you're referring to a different REST client, is that right? If so, you may use JIRA REST client.

I hope it helps.

Cheers

kiran July 31, 2014

hi Tiago,

thanks for response.

and this jira client i downloaded already but which is not working for me.

i got the client code from atlassian but still those also not working properly.

this bellow code asking to get lot of jars but not runnig

AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();    	

        final URI jiraServerUri = new URI("http://localhost:2990/jira");

        JiraRestClient restClient = factory.createWithBasicHttpAuthentication(jiraServerUri, "admin", "admin");    

URI attachURI = new URI("http://localhost:2990/jira/rest/api/2/issue/TEST-14/attachments");

        FileInputStream fis =new  FileInputStream("hello.txt");        

         Issue issue = (Issue) restClient.getIssueClient().getIssue("TEST-14").claim();

so i went for another solution and making the rest calls with CURL.

if you have the working client code and jars, please share me.

thanks

0 votes
Alexey_Rjeutski__Polontech_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 31, 2014

Curl is just a tool that uses REST API. How do you want to execute REST API commands? Anyway, you should form your request using that tool with the same parameters as in curl examples.

kiran July 31, 2014

i want to use the rest api to create an issue with attachment (from my local drive) using java JIRA REST api .

if it is not possible , how can i upload the attachment to existing issue in JIRA with Java JIRA REST API ?

these are my questions

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events