Skip to main content
Solved

Issues trying to retrieve cards form a collection with tags

  • November 27, 2024
  • 3 replies
  • 41 views

Hi, 

We’re trying to retrieve certain cards from a collection based on whether they have a specific tag present, but we’re not having much luck.

 

Example body below using “search for cards using JSON Query” - if we search without the “query block” below, we get results, if we search with it we get an “error parsing JSON body” response

{

"query": {

    "type": "tag",

    "op": "EXISTS",

    "ids": [

      "TAGNAME"

    ] }

  "searchTerms": "search string",

  "queryType": "cards",

  "collectionIds": [

    "COLLECTIONID"

  ]

}

 

Any help would be appreciated

Best answer by Joe Duffy

Hey ​@Rhys Hounsell 👋

It looks like you’re missing a comma after the query object. The updated JSON would look like this:

{
"query": {
"type": "tag",
"op": "EXISTS",
"ids": [
"TAGNAME"
]
},
"searchTerms": "search string",
"queryType": "cards",
"collectionIds": [
"COLLECTIONID"
]
}

Let me know if this works for you!

3 replies

Joe Duffy
Guru Employee
Forum|alt.badge.img
  • Guru Employee
  • Answer
  • November 27, 2024

Hey ​@Rhys Hounsell 👋

It looks like you’re missing a comma after the query object. The updated JSON would look like this:

{
"query": {
"type": "tag",
"op": "EXISTS",
"ids": [
"TAGNAME"
]
},
"searchTerms": "search string",
"queryType": "cards",
"collectionIds": [
"COLLECTIONID"
]
}

Let me know if this works for you!


  • Author
  • Knewbie
  • November 28, 2024

Thanks Joe, 

 

That cleared things up- sometimes its the simplest thing you can’t see for looking!

 

Appreciate your help!

 

Cheers

Rhys


  • Author
  • Knewbie
  • November 28, 2024

One other thing worth noting:

If I build this exact query out using the tooling here https://developer.getguru.com/reference/postv1searchquerysearchbyjsonforcardmanager

it is rejected as an invalid query - not sure why that is but it seems like the tooling isn't’ working 100% correctly?

Thanks again for your help,

Rhys