Hello,

I currently have a web application that has a RESTful API setup. I can
access the data through the call using Ajax requests within another
web application but I am having problems trying to access the same
data and calls through my Open Social application using the
gadgets.io.makeRequest method.

If I make a request to the proper URL through a browser, I get the
following Data/JSON file returned (example data for now):

[["2","dsz"],["164","new team"],["165","new team"],["166","new team"],
["167","new team"],["168","new team"],["169","new team"],["170","new
team"],["171","new team"],["172","new team"],["173","new team"],
["174","new team"],["175","new team"],["176","new team"],["177","new
team"],["178","new team"],["179","new team"],["180","new team"],
["181","new team"],["182","new team"],["183","new team"],["184","new
team"],["185","new team"],["186","new team"],["187","new team"],
["188","new team"],["189","new team"],["190","new team"],["191","new
team"],["192","new team"],["193","new team"],["194","new team"],
["195","new team"],["196","new team"],["197","new team"],["198","new
team"],["199","new team"],["200","new team"],["1","Saint John Team"]]

However, with the following code setup in my application it doesn't
seem to be getting the data properly (or at all possibly):

function listTeams() {
                var params = {};
        var url = "<MY_REST_URL_HIDDEN_FOR_POST>";
        params[gadgets.io.RequestParameters.CONTENT_TYPE] =
gadgets.io.ContentType.JSON;
        gadgets.io.makeRequest(url, teamResponse, params);
}
function teamResponse(obj) {
        /** obj.data contains an object corresponding with the JSON-encoded
response **/
alert("data:"+obj.data);
alert("errors:"+obj.errors);
alert("text:"+obj.text);
};

It doesn't seem to be sending any errors back or any data. I am trying
to run this example in the Ning Container the same as this example
they have listed in their tutorials (http://developer.ning.com/notes/
Ning_OpenSocial_Application_Tutorials):

<script type="text/javascript">

function request() {
  var params = {};
  // Content types available at
http://code.google.com/apis/opensocial/docs/0.7/reference/gadgets.io.ContentType.html
  params[gadgets.io.RequestParameters.CONTENT_TYPE] =
gadgets.io.ContentType.JSON;
  var url = "http://lastfm-api-ext.appspot.com/2.0/?
method=artist.getinfo&outtype=json&api_key=b25b959554ed76058ac220b7b2e0a026&artist=Cher";

  gadgets.io.makeRequest(url, response, params);
};

function response(obj) {
  /** obj.data contains an object corresponding with the JSON-encoded
response **/
  output("Cher");
  output(obj.data.image_large);
};

request();
</script>


Any assistance would be greatly appreciated. I've looked through the
documentation and I am not quite understanding what needs to be
changed for it to work properly. Thank you in advance!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"OpenSocial Application Development" group.
To post to this group, send email to opensocial-api@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/opensocial-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to