It's all about the answers!

Ask a question

RQM REST API - How to query keywords?

Steven Hu (813) | asked Jul 14 '14, 9:52 a.m.
I'm kinda stumped on this, so I'm hoping the community can point me in the right direction.

My goal is to query/filter the titles of keywords RESTfully, but my attempts haven't been successful. I know https://<host>:<port>/qm/service/<project-area>/keyword would help get me back all the basic fields of all the keywords in a certain project area, but is there a way to search for keywords by title? In my application I'm building, I want to be able to pluck a certain keyword out at any given time. The keywords will all be unique in the project, but without knowing the <id> ahead of time, I could only think of two ways to get the <id> if I knew the title--query for it (what I'm shooting for) or parse through https://<host>:<port>/qm/service/<project-area>/keyword, which would be wasteful since this will be done many, many times.

Any help appreciated!!

Accepted answer

permanent link
Donald Nong (14.5k314) | answered Jul 14 '14, 11:20 p.m.
Try this:
The square bracket is the filter, so replace "pattern" with your actual desired title. The ending /* means retrieving all fields. For more details, see
Steven Hu selected this answer as the correct answer

Steven Hu commented Jul 15 '14, 12:22 p.m.

Thanks Donald, you're a total boss. Exactly what I need and the further explanation really helped!

One other answer

permanent link
Srinivasarao A (633) | answered Aug 11 '14, 8:49 a.m.
edited Aug 11 '14, 9:01 a.m.

HI Donald

I need to filter the keywords based on category value.

I am using the below feed request, but it is giving me the entire list of available keywords. Please let me know if I am missing anything.

https://<host>>https://<host>:<port>/qm/service/<project-area>/keyword</a></font><a></a><a>?fields=keyword/category[@term='<categoryterm>' and @value='categoryvalue>']/*

Thanks In Advance

Donald Nong commented Aug 12 '14, 3:21 a.m. | edited Aug 12 '14, 3:25 a.m.

It works for me somehow, although the output is the category only, since the fields=keyword/category filtering. For example,
https://clm406:9443/qm/service/[@term="KC1" and @value="KC1_V2"]/
give me

<content type="application/xml">
<ns4:category value="KC1_V2" term="KC1" />
To get all the attributes, use this URL.
https://clm406:9443/qm/service/[category/@term="KC1" and category/@value="KC1_V2"]/

Notice the difference between the two "fields" parameters.

Your answer

Register or to post your answer.