Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,332,706
Community Members
 
Community Events
169
Community Groups

Jira REST API response suddenly stopped sending JSONP- getting invalid label syntax error

I was able to successfully query the API and get a jsonp response just fine with the following code until it stopped working all of a sudden:

$.ajax({
            type: "GET",
            url: "https://myurl.jira.com/rest/api/latest/search?jql=project=projname&jsonp-callback=cb",
            contentType: "application/javascript; charset=utf-8",
            dataType: "jsonp",     
            success: function (data) { },
            error: function (errormessage) { }
        });

function cb(data){

   //do stuff

}

The response is a regular json object and not javscript, i.e., cb({json})

Because of this, I'm getting the syntaxError invalid label. Did something change with the API in

the last 24 hours?

I also tried the even more basic approach:

$.getJSON("https://xxxxxxx.jira.com/rest/api/latest/issue/xxx-xx?jsonp-callback=?",
   function(data) {
     console.log(data);        
  });

And I get a SyntaxError: invalid label message in the console because it seems like the response is not being wrapped in a callback function but is sent as a straight json response.

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

We have disabled this functionality for security reasons across all OnDemand instances. You could wait until the plugin is fixed with more security features, or you can log a support ticket if you really need this re-enabled but you should be aware of the security risk as well.

Is there an expected completion date for the fix?

This should be fixed late February or March, but I can't say for certain,

Well it's late May now... still nothing. Just implement basic CORS support and that would replace all JSONP functionaity. All you need to do is return the contents of the "Origin" header as "Access-Control-Allow-Origin" on any request you originally had JSONP support on. It's even easier to implement than JSONP.

AgentSmith Atlassian Team Feb 10, 2014

I hate to be the bearer of bad news ... but unfortunately support will not be able to enable this functionality at this time.

Best we can offer is to keep watching https://jira.atlassian.com/browse/JRA-30371- please consider including any comments you might as well.

Was there any notice that this was being removed? We have several apps that use the API (including JSONP) for analysis and they're currently dead in the water.

Our scans found that very, very few customers were using this functionality. We determined the most prudent course of action would be to provide a way for us to re-enable it (in the short-term) on a per-customer basis and rely on customers contacting Support when they discovered the functionality stopped working. (You can still do this now.)

What will be "going away"? The entire REST API on On-Demand instances, or just the JSONP part of it?

What alternative methods exist to programmatically pull data from on On-Demand instance?

Garreth

Just the JSONP part of it. The recommended alternative method is to use OAuth (see an example doc and some other examples). We are also looking at CORS, although this is not complete yet (e.g. JRA-30371).

Is there any update on this?

The applications are being updated to remove JSONP callbacks (replacing them with alternative mechanisms that are more secure). As mentioned above, you can contact Support and ask for them to be re-enabled for now as a stop-gap, but eventually it will be going away. It would be worth looking into utilising one of these alternative methods to replace any of your systems currently using this.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS

Atlassian Community Events