Forum Discussion

wsurguy's avatar
wsurguy
Adept
8 years ago

Community API V2 LiQL following query returning empty set

I am trying to retrieve the following data using the query returned in the user object.   The query is SELECT * FROM users WHERE followers.id = 'XXXXX' where XXXXX is the user ID that is known to be following other users.  I can use the API V1 call to verify the user is following one of the other users but the V2 API is returning an empty set.    Must I be authenticated as an admin to retrieve the data using the V2 API or is there some other issue causing the empty set?

 

Thanks

  • wsurguy

     

    You can create a proxy endpoint in studio which effectively performs the call in Freemarker using APIv2 and output the raw data in JSON, and you should be able to parse header data into the request using Freemarker as well, I can't see any problems doing that.

     

    You'll need to pass any variables to the endpoint and sanitise them before performing the call which is easy to do and you should be able to pass those variables through the header request or alternatively as URL parameters.

     

    The Freemarker Context Objects documentation for Lithium may help with this.

     

  • wsurguy

     

    Are you testing the API v2 call in Studio? 

     

    I've run the same query and found it works as expected, if the user in question is not being followed by anyone then nothing is returned however if there are followers they do show up.

     

    If you can verify the same user id in API v1 returns results then this is likely to be a bug, especially if you can replicate the issue with more than one user id across both API v1 and API v2.

     

    In the case that you can replicate the issue, I'd recommend raising a support ticket with the details for the engineering team to take a look.

     

    Let us know how you get on,

     

     

    • wsurguy's avatar
      wsurguy
      Adept

      This is not in Studio.  In Studio via the API browser it works on our stage instance.

      I am using node.js to execute the call.

      • RobertT's avatar
        RobertT
        Boss

        wsurguy

         

        Would you mind going into a little more detail on how you're querying API v2 using NodeJS, I'm not quite sure but authentication may be playing a part.

         

        If it is, you may want to look at creating an Endpoint in Studio as a proxy to retrieve the data for NodeJS.