Page Status: updated 2023-01-25

Consent - Create

Page index

Introduction

Sv. Registrera dospatient, hantera åtkomstsamtycke.

This page describes how to create a consent for a patient by an example.

Creating a Consent is done by the following operation.

POST [base]/Consent

A set of HTTP headers must be provided in order to create a consnt and the consent itself is provided as a Consent in the HTTP body.

  • HTTP headers: see HTTP Header and Authorization for more information about the various headers used by the National Medication List.
  • HTTP body: see Consent for more information about the Consent resource.

Before a Consent is created, the user needs access to other information in the National Medication List. 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 - Create a multi dose dispensing consent

This example shows how to create a multi dose dispensing consent. The result can be seen at Fetch a multi dose dispensing consent.

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 75151d14-ab0f-48ee-a5a3-36e4821f54c2
x-user-agent {"name":"Test application","version":"0.01010101010.1 beta"} Decoded value

HTTP body: Create NLLMultiDoseDispConsent

Example 2 - Create an access consent

This example shows how to create an access consent. The result can be seen at Fetch an access consent.

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 pharmacy user Decoded value
x-purpose
x-request-id 7aacb4e9-1bf2-4893-914c-c59d4a1b8bae
x-user-agent {"name":"Test application","version":"0.01010101010.1 beta"} Decoded value

HTTP body: Create NLLAccessConsent