Stream: implementers
Topic: How to get entries from List using List id.
Karimulla (Nov 17 2017 at 12:23):
Hi,
I want to retrieve all entries in a List using List id.
For example : I have List object with id: 1234 which contains list of patients as entries.
How to get only Patients list from server.
I tried below url : server/List?_id=1234&_include=List:item which provides Patient (entries) but it also includes List (Resource).
Is there any way to retrieve only entries?
Please suggest me.
Thank you in Advance.
Lloyd McKenzie (Nov 17 2017 at 12:51):
If your list only contains one resource, then you could query on that resource type and use _has=List.id=1234. If you have multiple resources in your list, then you'll just have to run the query as you showed in your example and ignore the List entry.
Karimulla (Nov 17 2017 at 12:56):
Thank you Lloyd McKenzie.
I prepared url as below is this correct .
url : server /Patient?_has=List.id=1234.
I am getting error
"issue": [
{
"severity": "error",
"code": "processing",
"diagnostics": "Invalid _has parameter syntax: _has"
}
Can you please verify it. Am I doing anything wrong in that url
Lloyd McKenzie (Nov 17 2017 at 16:56):
My syntax was a little off. It should be ?_has:List:subject:id=1234
Karimulla (Nov 20 2017 at 04:46):
Hi Lloyd McKenzie,
I tried below url. I am getting still error.
url : server/Patient/?_has:List:subject:id=1234
I am getting error like below
"issue": [
{
"severity": "error",
"code": "processing",
"diagnostics": "Unknown parameter name: List:id"
}
Lloyd McKenzie (Nov 21 2017 at 01:37):
Are you using an STU3 server that supports _has?
Josh Mandel (Nov 21 2017 at 01:40):
Doesn't the need to be _id
anyway? Also, I've lost track of what this query is doing. The most recent version seems to say: "Get me any patients who are a subject of List 1234". This seems like a really complicated way to do this, given that List 1234 can only have at most a single subject :-)
Lloyd McKenzie (Nov 21 2017 at 01:42):
Ah, yes. It should have been _id
Karimulla (Nov 22 2017 at 06:08):
Thank you @Lloyd McKenzie & @Josh Mandel .
I got response by using _id in url : server/Patient/?_has:List:subject:_id=1234.
Thanks for your support.
Christiaan Knaap (Dec 03 2017 at 20:53):
Also consider _list.
Last updated: Apr 12 2022 at 19:14 UTC