Forum Discussion

Inactive User's avatar
Inactive User
6 years ago

API V1 equivalent for IN(x,y,z) and MATCHES(x y z)

Trying to find it in the documentation; unable.

I'd like to create a V1 query that has multiple IN values, i.e., in V2, it would be:

WHERE id MATCHES ("alpha beta gamma")

or 

WHERE id IN('1','2','3')

I saw something like this but I can't find it again in the documentation, which is frustrating

/restapi/vc/boards/id/discussions/tagging/tags/id/IN=1,2,3

 

Specifically, I want to make an API V1 call for multiple labels or tags

Thanks!

Note: I can't even find the IN and MATCHES in V2 anywhere in the V2 documentation even though I know it exists... 

10 Replies

  • Inactive User - This call might be helpful. 

     

    https://community.com/restapi/vc/search/messages?q=tags:(tag1%20AND%20tag2)%20AND%20is_root:true%20AND%20board_id:baord-id&sort_by=-topicPostDate
  • Hi Inactive User,

    the operators "IN" and "MATCHES" are only available in APIv2 and can't be used in APIv1 calls. But as TariqHussain mentioned in his post, you can use the search route of APIv1 and add tags in the query parameter.

    You won't find a specific documentation for the operators which can be used with APIv2 queries. But you can check the single resource documentations and read the constraints section. There you find all available operators  for each property.

     

    Regards,

    Christian

  • Inactive User's avatar
    Inactive User
    6 years ago

    TariqHussain  and cike thanks, however, this only returns an empty set using tags or labels, and I know there are messages with these tags in there ... https://community-stage.jmp.com/restapi/vc/search/messages?q=tags:("January")%20AND%20is_root:true%AND%20board_id:angular-test&sort_by=-topicPostDate 

    <response status="success">
    <messages/>
    </response>

     I don't see where you're getting :tags or nearly any of this query. Please help me locate it in the documentation. I can't find anything related to :tags or /search/ or ?q ... How do you find that? Thanks!

    I don't see anything labeled "constraints" either, so cike I appreciate your description but it makes no sense to me given the documentation. Can you give me some links that pertain to what you're talking aobut? 

    SuzieH, this documentation needs more examples on each section, and a clearer navigation. I'm confused and as you know I've been working with V2 for 2+years but can't make sense of this V1 API or its documentation. Thanks!

  • SuzieH's avatar
    SuzieH
    Khoros Alumni (Retired)
    6 years ago

    Hi Inactive User. Have you seen the WHERE Clause section under  Using LiQL? We have several examples of MATCHES in there. That doc is pretty light with regard to IN(). Let me know if that gets you closer to what you need?

    I've also got this TKB article. It tries to walk through what you can achieve with V1 and V2 search, where they overlap, and where you need to use one or the other. 

    I'm going to ask your question around the office here as well, but hopefully one of the Lithosphere members can help in the meantime.

  • Inactive User's avatar
    Inactive User
    6 years ago

    SuzieH Thanks.

    The WHERE clause reference seems to be the only place IN and MATCHES are mentioned. 

    Generally, my frustrations with the documentation are a matter of

    • Not being able to find things that I've read in the past but haven't bookmarked. It would be really great if 
    • Having new information in examples that isn't explained. For example, in the link you added, there's the following:
      https://your_community.lithium.com/restapi/vc/search/messages?q=label.text:wireless
    • However, that returns an empty set in the browser for me when I use the label Jupiter on Stage, where i know it exists. Which is another issue. A lot of the examples don't actually work in the real world. It's hard to know which ones will and which ones won't. 
      https://community-stage.jmp.com/restapi/vc/search/messages?q=label.text:Jupiter

      <response status="success">
      <messages/>
      </response>
    • The doc talks a little about q and f (thank you) but doesn't really say what and where I can find out where I can go to find out if things are fields or not. Also, the example of how to use a field is in the "Optionally specify a field to filter by using the format: q=field_name:text_string, such as subject:stereo" of the q parameter, not at all in the f parameter. Those kind of issues are frequent. 
    • This is really the only place I've found that mentions the /search/ parameter at all in V1, which is odd since it's common, I think. 
    • It would be really useful if there were a comprehensive index with links to relevant info. 
    • It would be great if the TKB link you sent me were on the API info page, for example (https://lithosphere.lithium.com/t5/Developer-Documentation/bd-p/dev-doc-portal?section=communityconcepts)
    • It just seems that most of the time I have to ask you or someone else rather than being able to find the answers I need in the documentation itself (and I'm sure I'm not alone). If they were my docs, I would see that as a failure of documentation design for usability. The Community helps support the docs, but I see many others looking for basic information all the time that should be able to be found in the docs. I'd like Lithium's documentation to be more like MDN/Javascript or the slightly less great JQuery documentation. I rarely have to look outside of those for structural answers. Sure, I go to StackOverflow if I can't figure it out, but I can usually find my answers with one of those resources and / or a Google search. I repeatedly find myself in the position with Lithium's docs of "Where do I find an answer???!" ...
    • I hope this is helpful. I know things like an index and a structural hierarchy would help many of us find the answer we're looking for rather than having to constantly ask the Community instead. The Community should be for things that aren't easily found in the documentation. Unfortunately, that's a lot of things! :(
  • SuzieH's avatar
    SuzieH
    Khoros Alumni (Retired)
    6 years ago

    Inactive User the specifics are very useful. Thank you, as always. 

  • Inactive User's avatar
    Inactive User
    6 years ago

    SuzieH Thanks, hope I'm being helpful and not snotty ;)

  • SuzieH's avatar
    SuzieH
    Khoros Alumni (Retired)
    6 years ago

    Not snotty at all :)

  • Inactive User's avatar
    Inactive User
    6 years ago

    Good, sometimes I'm not sure when I'm frustrated! :)

  • cike's avatar
    cike
    Champion
    6 years ago

    Inactive User it seems you need to specify the "q" and "f" parameter to get label or tag queries to work:

     https://community-stage.jmp.com/restapi/vc/search/messages?q=January&f=tags

    Tested this with the label parameter in one of our environments and it works.

    I think you can concat different filters and search parameter strings, too. Maybe this little piece of the Lihium Docs helps. :)