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

Kunle Ekunkonye February 17, 2013

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

2 votes
Answer accepted
Abdulrazaq Mohammed Ali Omar
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.
February 17, 2013

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.

Kunle Ekunkonye February 18, 2013

Is there an expected completion date for the fix?

Abdulrazaq Mohammed Ali Omar
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.
February 18, 2013

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

Matt Russell May 25, 2013

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
Atlassian Team members are employees working across the company in a wide variety of roles.
February 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.

0 votes
Bryan Grimes March 22, 2013

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.

Michael Knight
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 24, 2013

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.)

0 votes
deployment_user_mtt February 24, 2013

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

Michael Knight
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 25, 2013

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).

0 votes
deployment_user_mtt February 21, 2013

Is there any update on this?

Michael Knight
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 24, 2013

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
AUG Leaders

Atlassian Community Events