Page Status: updated 2022-10-27
Get ValueSet
Page index
Introduction
sv. Hämta värdemängder.
This page describes how to fetch the resource ValueSet by a few examples.
Value sets can be fetched in different ways. See ValueSet - Query Operations for information about all options.
In short, a query request is either a read, that is, a retrieval via the resource ID, or a search via a search condition. The result differs between a read and a search. A search results in a Bundle being returned containing all matching resources. If there are no hits, an empty Bundle is returned. A read results in the requested resource being returned or an error if no resource with the requested ID exists. If a system error occurs both searches and reads result in an error (i.e. an OperationOutcome).
Request
Fetching one or more value sets is done by one of the following operations;
GET [base]/ValueSet
GET [base]/ValueSet/[id]
Request Headers
See HTTP Header and Authorization for generic information about all HTTP headers used by the National Medication List including information about authorization, purpose and access type. The authorization token is translated to an authority role. The authority role together with the purpose and type of access is used by the National Medication List to determine what actions a user may perform and what information the user may access.
Header | Comment |
---|---|
authorization | The users's security token |
prefer | Type of returned content |
x-access | The cause for the call |
x-context-id | An ID to group a sequence of requests |
x-org-info | Information about the users's organisation |
x-patientref | The logical ID of the patient |
x-provenance | A provenance resource with information about the user interacting with NLL |
x-purpose | The purpose of the call |
x-request-id | A random and unique ID |
x-user-agent | Information about the calling system |
Response Body
See ValueSet for more information about the ValueSet resource.
Examples
Example 1 - Get all value sets
This example shows how to fetch the current version of all value sets. The bundle in the example is not complete for readability reasons. Only 4 value sets are included in the example and 2 of those are only represented in part. A true search of this kind would return approximatly 80 value sets.
Request
The request is made as a request of the resource;
GET [base]/ValueSet
Request Headers
Header | Value | Comment |
---|---|---|
x-request-id | d4684d85-d4c3-44c1-8f66-8b4854cfe0bc |
|
x-user-agent | {"name":"Test system testaren","version":"0.01010101010.1 beta"} |
Decoded value |
Response Body
See Fetch ValueSet by a search.
Example 2 - Get a specific value set by the ID
This example shows how to fetch the current version of a specific value set, in this case Förmånsval (benefit-choices
).
Request
The request is made as a read by the logical id;
GET [base]/ValueSet/benefit-choices
Request Headers
Header | Value | Comment |
---|---|---|
x-request-id | a1ef66c3-d6f8-4c68-9f20-a97d81e9f38a |
|
x-user-agent | {"name":"Test system testaren","version":"0.01010101010.1 beta"} |
Decoded value |
Response Body
See Förmånsval (benefit-choices).
Example 3 - Get all versions of a value set
This example shows how to fetch all versions of a specific value set, in this case nll-snomed-behandlingsorsak.
The history is only available for value sets that are updated on regular basis. See TA 34 – Hämta värdemängder och kodrelationer for information about value sets that must be updated daily.
Request
The request is made as a read by the logical id;
GET [base]/ValueSet/nll-snomed-behandlingsorsak/_history
Request Headers
Header | Value | Comment |
---|---|---|
x-request-id | f18f7a84-a196-4058-8b9a-3c3cd11914d2 |
|
x-user-agent | {"name":"Test system testaren","version":"0.01010101010.1 beta"} |
Decoded value |