Webservice returns empty string

Hi, I'm writing my first web services for elgg. I'm facing an issue.

Calling the webservice from a browser displays a correctly formated json response while calling the webservice from an ajax call (with jquery) sends an empty string...causing failure in the ajax call.

web servire URL : http://dev.mgogolf.com/services/api/rest/json/?method=user.authentication&username=test&password=test

test from jsfiddle : http://jsfiddle.net/53Lf3/10/

So I think it is something happening on server side... but I cannot figure it out.


Could you help me please?

  • My guess is that you are logged in using the browser but not with the ajax call. Does this web service method require access to data that only a logged in user can see?

  • Hi Cash,

    I've checked that I wasn't logged in before doing the call from the browser. The webservice accepts anonym login...as it is to check if the user exists and can logged in.

    It is like if there is a check in the header that forbids call from another sources than browsers.


  • I just grabbed your test code, modified it to call system.api.list, and tried running it on my localhost in 2 ways:

    • hit localhost and it succeeded
    • hit the same endpoint on the community site and it failed


  • So have you any clue on how I can handle this problem ?

  • Well, that doesn't establish were the problem is. I don't have time right now to determine why that jQuery code is failing on the call to the community site (and it's not an empty string for it - it is calling the error callback).