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?
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:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<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>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.