jsonp getting 404 when calling Redmine API

Added by eea dev about 5 years ago

I am trying to consume Redmine API from an angularjs project.

I ended up using jsonp in order to solve CORS problem.

Why do I receive 404 when calling this:

var url = 'http://muser:mpasswd@myredmine/issues.json?callback=displayIssues';
$http({
method: 'JSONP',
url: url
}).
success(function (data, status) {
console.log("success");
console.log(data);
}).
error(function (data, status) {
console.log("Error: " + status);
});
...
function displayIssues(issues) {
console.log('displayIssues');
...
}
if the url actually exist and can be called via Postman?

here is my console:

GET http://muser:mpasswd@myredmine/issues.json?callback=displayIssues jsonpReq angular.js:8576(anonymous function) angular.js:8420sendReq angular.js:8291serverRequest angular.js:8025wrappedCallback angular.js:11498wrappedCallback angular.js:11498(anonymous function) angular.js:11584Scope.$eval angular.js:12608Scope.$digest angular.js:12420Scope.$apply angular.js:12712(anonymous function) angular.js:18980x.event.dispatch jquery-2.0.3.min.js:5y.handle @ jquery-2.0.3.min.js:5
authentication.service.js:100 Error: 404

Replies (2)

RE: jsonp getting 404 when calling Redmine API - Added by John Paul Dominikkam about 5 years ago

Hi ,

before calling api you have logged in to redmine and maintain session with current user then only get response

Regards
John

RE: jsonp getting 404 when calling Redmine API - Added by eea dev about 5 years ago

thanks John,

I logged on using the basic http auth.

What should I do next?

I tried and call the GET on issues.json but still getting 401. I am using angularjs

Many thanks in advance

(1-2/2)