Ajax call confluence search rest API?

Thomas May 8, 2017

hello, 

I'm trying to call confluence search API with ajax from outside the environment, but get below error, when i click on the search(1,11), i can get the expected result, please advise. 

+++++++++++  ERROR ++++++++++++++++++++++++++

SCRIPT1004: Expected ';'

search(1,11)

{"description":"jCallback was not called","stack":"Error: jCallback was not called...

+++++++++++ CODE +++++++++++++++++++++++++++

function jCallback(json){
    console.log(json);
}

 

var wikiAPI = "https://xx.xx/confluence/rest/searchv3/1.0/search?queryString=global&pageSize=10&os_authType=basic";

$.ajax({
    url:wikiAPI,
    type:"GET",
    contentType:'application/jsonp',
    dataType:"jsonp",
    crossDomain:true,
    beforeSend: function(xhr) { xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); },
    jsonpCallback:'jCallback',
    error: function(xhr,status,error) {
        console.log(JSON.stringify(error));
    },
    success: function(response){
        console.log(response);
   }
});

1 answer

0 votes
JP _AC Bielefeld Leader_
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.
June 6, 2017

Hi,

you should try asking this question to the developer community. I'm pretty sure you'll find some help there.

https://developer.atlassian.com/community/

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events