Page Status: updated 2022-11-09

Resource independent extended operations

Page index

Introduction

This page describes how to use extended operations that are resource independent, i.e. they are invoked by a call to the server without naming a resource, by an example.

POST [base]/$[operation]

For a summary of all extended operation see OperationDefintion.

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

Some operations requires other information from the National Medication List before they can be used. For more information on different scenarios and what information is required for each scenario, see Handbok för vård- och apotekstjänster: Verksamhetsområden.

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 - Using $patient-dosage-directions

This operation creates patient friendly dosage directions based on the structured dosage elements. The dosage directions can be printed on the label that is attached to the medication at the pharmacy. There is also a formatted version that can be printed separetely and handed to the patient when needed.

The request is made by a POST to the base path of the server, POST [base]/$patient-dosage-directions.

See NLLPatientDosageDirections for more information about the $patient-dosage-directions operation.

HTTP headers

Header Value Comment
authorization
prefer
x-access
x-org-info
x-patientref
x-provenance
x-purpose
x-request-id c2654b3a-5a03-40bf-a16e-69c621cfca46
x-user-agent {"name":"Test system testaren","version":"0.01010101010.1 beta"} Decoded value

HTTP body:
Request: Example of generating a dosage instruction
Response: Example of generating a dosage instruction

Example 2 - Using $restore

This operation restores one or two (parallell) prescription(s) to a previous version.

The request is made by a POST to the base path of the server, POST [base]/$restore.

See NLLRestore for more information about the $patient-dosage-directions operation.

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 Provenance for a healthcare user Decoded value
x-purpose
x-request-id c2654b3a-5a03-40bf-a16e-69c621cfca46
x-user-agent {"name":"Test system testaren","version":"0.01010101010.1 beta"} Decoded value

HTTP body:
Request: Example of restoring MedicationRequest to previous versions
Response: Example of restoring MedicationRequest to previous versions