Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Does anyone know why I get the the error 404-not found when I try to access some data using REST API for JIRA ?

Daniela Mateescu November 7, 2011

I have tried to access some data using REST API for Jira like in the turorial from www.developer.atlassian.com.

I have done this from the command line using curl like this:

curl -D- -u daniela.mateescu:master -X GET -H "Content-Type: application/json" http://localhost:8081/rest/api/2/issue/createmeta

I get the Http status 404- Not found /rest/api/2/createmeta resource is not available and I don't know why because:

-I have installed JIRA and I understood that the REST API comes with JIRA

-The username and password ar the ones for the administrator

-I have tried to make some other request like the one for getting the issues for a specified user and I get the same result

Could anybody help me please?


1 answer

1 accepted

1 vote
Answer accepted
Sander Brienen [Avisi]
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.
November 8, 2011
Check your jira base URL. If it is localhost:8080/jira/ (the default URL for out-of-the-box jira), then add /rest/api/2/issue/createmeta to this URL. That should work. But the createmeta API call does not sound familiar though.
Daniela Mateescu November 13, 2011

Thak you for your answer.

I've realized what the problem was. It was from the version(2) from the ULR. It should have been latest instead of 2. Now it workes fine when making the request using the curl program.

But now, I have other problem . I try to make the request from flex, but I saw that flex strips out the headers of a GET HttpRequest. I saw that this is a common problem for flex developers, but I didn't find any solution for this problem. I have an object like the one below:

Daniela Mateescu November 13, 2011


Despite the fact I set the header that I want(**1,**2,**3), when consructing the final request, flex doesn't put my headers.

It's request looks like this:

GET /rest/api/latest/search HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Cookie: AJS.conglomerate.cookie=|||||upm.tab=install; atlassian.xsrf.token=B6U8-9QJE-MERN-EWEL|46f56a35a7a426b7c1d1cad0d315c39b32cae052|lout

Can anybody with more experience in flex programming, help me with my problem, please?

Daniela Mateescu November 13, 2011

<mx:HTTPService id="httpserv" url="http://localhost:8081/rest/api/latest/search" result="httpResultHandler(event);" fault="httpFaultHandler(event);" method="GET" >
</mx:HTTPService>

<mx:VBox>
<mx:HBox>
<mx:TextInput id="username"/>
<mx:TextInput id="password"/>
</mx:HBox>
<mx:Button label="Trimite" id="sendButton" click="trimiteHandler()">

</mx:Button>
</mx:VBox>

and the functions:

<mx:Script>
<![CDATA[
import mx.rpc.AsyncToken;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.utils.Base64Encoder;

protected function trimiteHandler():void {
//Security.allowDomain("*");
Security.loadPolicyFile("http://localhost:8081/crossdomain.xml");
var encripter:Base64Encoder = new Base64Encoder();
encripter.insertNewLines = false;
encripter.encode(username.text + ":" + password.text);
var encriptedCredentials:String = encripter.toString();


httpserv.headers["Authorization"] = "Basic " + encriptedCredentials;//**1
httpserv.headers["Content-Type"] = "application/json";//**2
httpserv.headers["Accept"] = "*/*";//**3
httpserv.send();
sendButton.label = "Send";

}

protected function httpResultHandler(event:ResultEvent):void {
var obj:Object = event.headers;
sendButton.label = "corect";
}

protected function httpFaultHandler(event:FaultEvent):void {
var obj:Object = event.headers;
sendButton.label = "eroare";
}
]]>
</mx:Script>

Sander Brienen [Avisi]
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.
November 17, 2011

Sorry, I have no experience with flex. But if you think my answer was correct, please accept it. It will help other people to see that there was a correct answer to the question.

Daniela Mateescu November 23, 2011

Hello,

I write this message to say thanks for your answer and to let you know that I try to figure it out what the problem was. In fact Flash doesn't let you make a GET request that has custom headers. Having that so, I made the request from javaScript and it worked.

Thank you again and good by!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events