Forum Discussion

smogger914's avatar
9 years ago

Java call not returning author.email, but the studio api browser does

I am doing an api call with a java client and executing the following query using api v2:

 

SELECT id, body, view_href, subject, author.email FROM messages WHERE replies.count(*) = 0 AND depth = 0

 

When I look at the author.email field it comes back empty. If I do the same query in the studio api browser the email is returned. Can anyone think of why this would happen? All the other values are coming back.

 

api browser:

{
"status" : "success",
"message" : "",
"http_code" : 200,
"data" : {
"type" : "messages",
"list_item_type" : "message",
"size" : 1,
"items" : [ {
"type" : "message",
"id" : "58",
"view_href" : "/t5/Welcome-Board/asdsada/m-p/58#M36",
"author" : {
"type" : "user",
"email" : "blah@blah.com"
},
"subject" : "asdsada",
"body" : "<P>asdasdasdasd</P>"
} ]
},
"metadata" : { }
}

 

java code:

{
   "metadata":{

   },
   "http_code":200,
   "data":{
      "size":1,
      "list_item_type":"message",
      "type":"messages",
      "items":[
         {
            "author":{
               "type":"user",
               "email":""
            },
            "subject":"asdsada",
            "id":"58",
            "href":"/messages/58",
            "type":"message",
            "body":"<P>asdasdasdasd<\/P>",
            "view_href":"http://stage-community.zuora.com/t5/Welcome-Board/asdsada/m-p/58#M36"
         }
      ]
   },
   "message":"",
   "status":"success"
}

  • OlivierS's avatar
    OlivierS
    Lithium Alumni (Retired)

    No idea smogger914

     

    But what happen in your Java client if you change your query to something less restrictive, e.g.: 

     

    SELECT * FROM messages WHERE replies.count(*) = 0 AND depth = 0

    Do you get the author email? 

    • smogger914's avatar
      smogger914
      Guide

      OlivierS when I do the SELECT * query the author object doesn't have the email. It looks like this:

       

      "author" : {
      "type" : "user",
      "id" : "3",
      "href" : "/users/3",
      "view_href" : "/t5/user/viewprofilepage/user-id/3",
      "login" : "blah"
      },

       

      I did author.email hoping it would work because I wanted to avoid doing another query to get each authors email. Seems like I will have to...

      • OlivierS's avatar
        OlivierS
        Lithium Alumni (Retired)

        Just a thought here ... smogger914

         

        It might be a permission issue ... When you're using the API browser, you're logged as an administrator.

         

        When running your JAVA code, is your user authenticated as an Admin, or has he just the API privileges?