1

I am hosting an GAE Application and try to get Google Clound Endpoints to work. Now everything is setup and tested with curl:

curl http://localhost:8888/_ah/api/myendpoint/v1/queryData

Returns exactly 1 item which is correct:

{
  "items" : [ {
    "id" : "220",
    "timestamp" : "1371475009682951",
    "identifier" : "test1.0",
    "value" : "523"
  } ]
}

For no reason the same call through my JavaScript client returns nothing:

gapi.client.myendpoint.queryData().execute( function(result) {
        console.log("result: " + result);
});

The output I get is:

result: [object Object]

What am I missing out? Thanks for your help.

gizmo
  • 15
  • 2

1 Answers1

3

result is already a JSON Object and not a string.

With "result: " + result you force casting the object to a string and [object Object] is just the way this is displayed by default.

For example console.log("result: " + {"name": "I'm an object!"}) will give you exactly the same output

Try console.log(result) instead and you should see the real contents of the response.

Scarygami
  • 15,009
  • 2
  • 35
  • 24
  • Thanks a lot. Just got back to my questions to comment exactly about that cause I just realized myself. Must be the temperature here that makes me blind. :) – gizmo Jun 19 '13 at 08:29