Forum Discussion

hayata's avatar
5 years ago

Additional subscription fields in LiQL.

I need to get a list of subscription for a user. I am using the below query.

SELECT target,target.id,target.subject,target.board.title,target.post_time,target.last_post_time,target.user_context.read,target.view_href FROM subscriptions WHERE target.type='conversation'

I guessed as some of the fields. The following are not returning values:

  • target.subject
  • target.post_time
  • target.user_context.read

Could someone advise if the data is available and what the correct names are?

My alternative is to get a list of message Id's and then query messages object, but it adds execution time.

1 Reply

  • hayata,

    For Target field value is different for each target.type in subscription:

    Like:

    WHERE target.type='conversation'

    will return only these types of attributes for target

    "target" : {
            "type" : "conversation",
            "id" : "123",
            "view_href" : "/t5/posturl",
            "style" : "blog",
            "thread_style" : "blog",
            "messages_count" : 2,
            "solved" : false,
            "last_post_time" : "2020-07-14T07:27:54.963-07:00",
            "last_post_time_friendly" : "07-14-2020",
            "last_posting_activity_time" : "2020-07-14T07:27:54.963-07:00"
          }

     For message it will be

    "target" : {
            "type" : "message",
            "id" : "123",
            "href" : "/messages/123",
            "view_href" : "/t5/message_url"
          },	

     

    Similarly it will be different for each of the following:

     

    • message
    • thread
    • board
    • category
    • grouphub
    • product
    • label