Public
Occasional Contributor

nested subquery with v2 json query

i am fetching occasion_data via v2 json query and result is a list of object which looks something like this.

```

{
"type": "message",
"id": "<messageid>",
"occasion_data": {
   "type": "occasion_data",
   "rsvp": {
      "query": "SELECT * FROM rsvps WHERE message.id = '<msgid>'"
   }

```

here i want to fetch rsvps list too using sub-queries.

when i tried in this way. it didn't work. 

```

{
"messages": {
"fields": [
"id",
"occasion_data.rsvp"
],
"constraints": [
{
"occasion_data.end_time": {
">=": 1
}
}
],
"subQueries": {
"occasion_data.rsvp": {
"fields": []
}
}
}
}

```

i believe the reason is because rsvp is a field in occasion_data which is field in message itself. 

pleas let me know if any doing wrong or a workaround.

 

1 Reply 1
Khoros Alumni (Retired)

Hello Vamshi,

occasion_data.rsvp is currently not a field which is supported in sub queries. The way to retrieve the list of rsvps for a messsage is either through the LIQL query mentioned above: 

"SELECT * FROM rsvps WHERE message.id = '<msgid>'"

or using the following JSON in API call

```

{
  "rsvps": {
    "fields": [
      "rsvp_response",
      "user"
    ],
    "constraints": [
      {
        "message.id": {
          "=": "<msgid>"
        }
      }
    ]
  }
}

```

Welcome to the Technology board!

Curious about our platform? Looking to connect on social technology? You've come to the right place!

Are you a Khoros customer? For direct assistance from our Support team, please visit the Support Forum.