Access RestAPI via javascript
Hi,
I recently upgraded to Youtrack 6.0. Before that I was running Youtrack as a .war file within my Teamcity-Tomcat. This wasn't possible anymore so I choose to install Youtrack via .msi installer. I've got a dashboard written in javascript with AngularJS. I try to access the sprint information like this:
sprints: $resource('http://team:8080/rest/agile/Q-0/sprints', {}, {
'query': { method: 'GET', headers: { 'Content-Type': 'application/json'} }
}),
This worked until now. Of course I had to set the CORS settings in the new web.xml, since Youtrack wasn't running in the Tomcatserver anymore:
<filter>
<filter-name>cross-origin</filter-name>
<filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
<init-param>
<param-name>allowedOrigins</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>allowedMethods</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>allowedHeaders</param-name>
<param-value>*</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>cross-origin</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
When I try to access the RestAPI via Browser everything is fine. But the javascript is not able to save the cookie because it seems to be httpOnly (using guest authentication)
Am I missing some settings in Youtrack/Jetty or do I have to ajust my javascript to some changes in the API?
I recently upgraded to Youtrack 6.0. Before that I was running Youtrack as a .war file within my Teamcity-Tomcat. This wasn't possible anymore so I choose to install Youtrack via .msi installer. I've got a dashboard written in javascript with AngularJS. I try to access the sprint information like this:
sprints: $resource('http://team:8080/rest/agile/Q-0/sprints', {}, {
'query': { method: 'GET', headers: { 'Content-Type': 'application/json'} }
}),
This worked until now. Of course I had to set the CORS settings in the new web.xml, since Youtrack wasn't running in the Tomcatserver anymore:
<filter>
<filter-name>cross-origin</filter-name>
<filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
<init-param>
<param-name>allowedOrigins</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>allowedMethods</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>allowedHeaders</param-name>
<param-value>*</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>cross-origin</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
When I try to access the RestAPI via Browser everything is fine. But the javascript is not able to save the cookie because it seems to be httpOnly (using guest authentication)
Am I missing some settings in Youtrack/Jetty or do I have to ajust my javascript to some changes in the API?
1 comment
Sort by
Date
Votes
I still have no clue why this won't work anymore...
Please sign in to leave a comment.