Page Status: updated 2022-10-31

Medication - Fetch

Page index

Introduction

Sv. Hämta artikelinformation.

This page describes how to fetch the resource Medication by a few examples.

A Medication can be fetched in different ways. See Medication 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).

Fetching a Medication is done by one of the following operations.

GET [base]/Medication/[id]
GET [base]/Medication?[search parameters]

A set of HTTP headers must be provided in order to fetch a Medication. See HTTP Header and Authorization for more information about the various headers used by the National Medication List.

See Medication for more information about the Medication resource.

Examples

HTTP 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

Example 1 - Fetch a medication with dispensing restriction

This example shows a medication with dispensing restriction. Note that a medication has a NPL-pack ID as business identifier.

The request is made as a search by the NPL-pack ID, GET [base]/Medication?nplPackId=20120704100050.

HTTP headers

Header Value Comment
authorization {...,"FORSKRIVARKOD":"9000027","VARDGIVARE":"0123456789","YRKESKOD":["LK"],"loa":3} Selected information from the OAuth2-ticket in decoded form
prefer
x-access
x-org-info {"orgenhetsOrt":"Sala"} Decoded value
x-patientref
x-provenance
x-purpose
x-request-id 4b5e7f1a-a0eb-4cbe-b94e-3952070dd8d2
x-user-agent {"name":"Test system testaren","version":"0.01010101010.1 beta"} Decoded value

HTTP body: Fetch Medication with dispensing restriction

Example 2 - Fetch a medication eligible for reimbursement

This example shows a medication eligible for reimbursement.

The request is made as a search by the logical id of the medication, GET [base]/Medication/125a8cb6-15fe-4213-b5cd-84031f9c4feb.

HTTP headers

Header Value Comment
authorization {...,"FORSKRIVARKOD":"9000027","VARDGIVARE":"0123456789","YRKESKOD":["LK"],"loa":3} Selected information from the OAuth2-ticket in decoded form
prefer
x-access
x-org-info {"orgenhetsOrt":"Sala"} Decoded value
x-patientref
x-provenance
x-purpose
x-request-id 20ca1572-e004-4591-a972-1a69e735f2d5
x-user-agent {"name":"Test system testaren","version":"0.01010101010.1 beta"} Decoded value

HTTP body: Fetch Medication eligible for reimbursement

Example 3 - Fetch a medical consumable

This example shows a medical consumable. Note that a medical consumable has a Varunr as business identifier.

The request is made as a search by the Varunr, GET [base]/Medication?varunr=738420.

HTTP headers

Header Value Comment
authorization {...,"FORSKRIVARKOD":"9000027","VARDGIVARE":"0123456789","YRKESKOD":["LK"],"loa":3} Selected information from the OAuth2-ticket in decoded form
prefer
x-access
x-org-info {"orgenhetsOrt":"Sala"} Decoded value
x-patientref
x-provenance
x-purpose
x-request-id 4e07a140-b82e-485d-972e-0862594d4a7a
x-user-agent {"name":"Test system testaren","version":"0.01010101010.1 beta"} Decoded value

HTTP body: Fetch Medication of type medical consumable