Skip to main content

Class: MedplumClient

The MedplumClient class provides a client for the Medplum FHIR server.

The client can be used in the browser, in a NodeJS application, or in a Medplum Bot.

The client provides helpful methods for common operations such as: 1) Authenticating 2) Creating resources 2) Reading resources 3) Updating resources 5) Deleting resources 6) Searching 7) Making GraphQL queries

Here is a quick example of how to use the client:

import { MedplumClient } from '@medplum/core';
const medplum = new MedplumClient();

Create a Patient:

const patient = await medplum.createResource({
resourceType: 'Patient',
name: [{
given: ['Alice'],
family: 'Smith'
}]
});

Read a Patient by ID:

const patient = await medplum.readResource('Patient', '123');
console.log(patient.name[0].given[0]);

Search for a Patient by name:

const bundle = await medplum.search('Patient', 'name=Alice');
console.log(bundle.total);

Hierarchy

  • EventTarget

    MedplumClient

Read

readResource

readResource<K>(resourceType, id, options?): ReadablePromise<ExtractResource<K>>

Reads a resource by resource type and ID.

Example:

const patient = await medplum.readResource('Patient', '123');
console.log(patient);

See the FHIR "read" operation for full details: https://www.hl7.org/fhir/http.html#read

Type parameters

NameType
Kextends "Patient" | "Practitioner" | "RelatedPerson" | "AccessPolicy" | "Account" | "ActivityDefinition" | "AdverseEvent" | "AllergyIntolerance" | "Appointment" | "AppointmentResponse" | "AuditEvent" | "Basic" | "Binary" | "BiologicallyDerivedProduct" | "BodyStructure" | "Bot" | "Bundle" | "CapabilityStatement" | "CarePlan" | "CareTeam" | "CatalogEntry" | "ChargeItem" | "ChargeItemDefinition" | "Claim" | "ClaimResponse" | "ClientApplication" | "ClinicalImpression" | "CodeSystem" | "Communication" | "CommunicationRequest" | "CompartmentDefinition" | "Composition" | "ConceptMap" | "Condition" | "Consent" | "Contract" | "Coverage" | "CoverageEligibilityRequest" | "CoverageEligibilityResponse" | "DetectedIssue" | "Device" | "DeviceDefinition" | "DeviceMetric" | "DeviceRequest" | "DeviceUseStatement" | "DiagnosticReport" | "DocumentManifest" | "DocumentReference" | "EffectEvidenceSynthesis" | "Encounter" | "Endpoint" | "EnrollmentRequest" | "EnrollmentResponse" | "EpisodeOfCare" | "EventDefinition" | "Evidence" | "EvidenceVariable" | "ExampleScenario" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "GraphDefinition" | "Group" | "GuidanceResponse" | "HealthcareService" | "ImagingStudy" | "Immunization" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "ImplementationGuide" | "InsurancePlan" | "Invoice" | "JsonWebKey" | "Library" | "Linkage" | "List" | "Location" | "Login" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationRequest" | "MedicationStatement" | "MedicinalProduct" | "MedicinalProductAuthorization" | "MedicinalProductContraindication" | "MedicinalProductIndication" | "MedicinalProductIngredient" | "MedicinalProductInteraction" | "MedicinalProductManufactured" | "MedicinalProductPackaged" | "MedicinalProductPharmaceutical" | "MedicinalProductUndesirableEffect" | "MessageDefinition" | "MessageHeader" | "MolecularSequence" | "NamingSystem" | "NutritionOrder" | "Observation" | "ObservationDefinition" | "OperationDefinition" | "OperationOutcome" | "Organization" | "OrganizationAffiliation" | "Parameters" | "PasswordChangeRequest" | "PaymentNotice" | "PaymentReconciliation" | "Person" | "PlanDefinition" | "PractitionerRole" | "Procedure" | "Project" | "ProjectMembership" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RequestGroup" | "ResearchDefinition" | "ResearchElementDefinition" | "ResearchStudy" | "ResearchSubject" | "RiskAssessment" | "RiskEvidenceSynthesis" | "Schedule" | "SearchParameter" | "ServiceRequest" | "Slot" | "Specimen" | "SpecimenDefinition" | "StructureDefinition" | "StructureMap" | "Subscription" | "Substance" | "SubstanceNucleicAcid" | "SubstancePolymer" | "SubstanceProtein" | "SubstanceReferenceInformation" | "SubstanceSourceMaterial" | "SubstanceSpecification" | "SupplyDelivery" | "SupplyRequest" | "Task" | "TerminologyCapabilities" | "TestReport" | "TestScript" | "User" | "UserConfiguration" | "ValueSet" | "VerificationResult" | "VisionPrescription"

Parameters

NameTypeDescription
resourceTypeKThe FHIR resource type.
idstringThe resource ID.
optionsRequestInit-

Returns

ReadablePromise<ExtractResource<K>>

The resource if available; undefined otherwise.

Defined in

packages/core/src/client.ts:970


readReference

readReference<T>(reference, options?): ReadablePromise<T>

Reads a resource by Reference.

This is a convenience method for readResource() that accepts a Reference object.

Example:

const serviceRequest = await medplum.readResource('ServiceRequest', '123');
const patient = await medplum.readReference(serviceRequest.subject);
console.log(patient);

See the FHIR "read" operation for full details: https://www.hl7.org/fhir/http.html#read

Type parameters

NameType
Textends Resource

Parameters

NameTypeDescription
referenceReference<T>The FHIR reference object.
optionsRequestInit-

Returns

ReadablePromise<T>

The resource if available; undefined otherwise.

Defined in

packages/core/src/client.ts:997


readHistory

readHistory<K>(resourceType, id, options?): ReadablePromise<Bundle<ExtractResource<K>>>

Reads resource history by resource type and ID.

The return value is a bundle of all versions of the resource.

Example:

const history = await medplum.readHistory('Patient', '123');
console.log(history);

See the FHIR "history" operation for full details: https://www.hl7.org/fhir/http.html#history

Type parameters

NameType
Kextends "Patient" | "Practitioner" | "RelatedPerson" | "AccessPolicy" | "Account" | "ActivityDefinition" | "AdverseEvent" | "AllergyIntolerance" | "Appointment" | "AppointmentResponse" | "AuditEvent" | "Basic" | "Binary" | "BiologicallyDerivedProduct" | "BodyStructure" | "Bot" | "Bundle" | "CapabilityStatement" | "CarePlan" | "CareTeam" | "CatalogEntry" | "ChargeItem" | "ChargeItemDefinition" | "Claim" | "ClaimResponse" | "ClientApplication" | "ClinicalImpression" | "CodeSystem" | "Communication" | "CommunicationRequest" | "CompartmentDefinition" | "Composition" | "ConceptMap" | "Condition" | "Consent" | "Contract" | "Coverage" | "CoverageEligibilityRequest" | "CoverageEligibilityResponse" | "DetectedIssue" | "Device" | "DeviceDefinition" | "DeviceMetric" | "DeviceRequest" | "DeviceUseStatement" | "DiagnosticReport" | "DocumentManifest" | "DocumentReference" | "EffectEvidenceSynthesis" | "Encounter" | "Endpoint" | "EnrollmentRequest" | "EnrollmentResponse" | "EpisodeOfCare" | "EventDefinition" | "Evidence" | "EvidenceVariable" | "ExampleScenario" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "GraphDefinition" | "Group" | "GuidanceResponse" | "HealthcareService" | "ImagingStudy" | "Immunization" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "ImplementationGuide" | "InsurancePlan" | "Invoice" | "JsonWebKey" | "Library" | "Linkage" | "List" | "Location" | "Login" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationRequest" | "MedicationStatement" | "MedicinalProduct" | "MedicinalProductAuthorization" | "MedicinalProductContraindication" | "MedicinalProductIndication" | "MedicinalProductIngredient" | "MedicinalProductInteraction" | "MedicinalProductManufactured" | "MedicinalProductPackaged" | "MedicinalProductPharmaceutical" | "MedicinalProductUndesirableEffect" | "MessageDefinition" | "MessageHeader" | "MolecularSequence" | "NamingSystem" | "NutritionOrder" | "Observation" | "ObservationDefinition" | "OperationDefinition" | "OperationOutcome" | "Organization" | "OrganizationAffiliation" | "Parameters" | "PasswordChangeRequest" | "PaymentNotice" | "PaymentReconciliation" | "Person" | "PlanDefinition" | "PractitionerRole" | "Procedure" | "Project" | "ProjectMembership" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RequestGroup" | "ResearchDefinition" | "ResearchElementDefinition" | "ResearchStudy" | "ResearchSubject" | "RiskAssessment" | "RiskEvidenceSynthesis" | "Schedule" | "SearchParameter" | "ServiceRequest" | "Slot" | "Specimen" | "SpecimenDefinition" | "StructureDefinition" | "StructureMap" | "Subscription" | "Substance" | "SubstanceNucleicAcid" | "SubstancePolymer" | "SubstanceProtein" | "SubstanceReferenceInformation" | "SubstanceSourceMaterial" | "SubstanceSpecification" | "SupplyDelivery" | "SupplyRequest" | "Task" | "TerminologyCapabilities" | "TestReport" | "TestScript" | "User" | "UserConfiguration" | "ValueSet" | "VerificationResult" | "VisionPrescription"

Parameters

NameTypeDescription
resourceTypeKThe FHIR resource type.
idstringThe resource ID.
optionsRequestInit-

Returns

ReadablePromise<Bundle<ExtractResource<K>>>

Promise to the resource history.

Defined in

packages/core/src/client.ts:1096


readVersion

readVersion<K>(resourceType, id, vid, options?): ReadablePromise<ExtractResource<K>>

Reads a specific version of a resource by resource type, ID, and version ID.

Example:

const version = await medplum.readVersion('Patient', '123', '456');
console.log(version);

See the FHIR "vread" operation for full details: https://www.hl7.org/fhir/http.html#vread

Type parameters

NameType
Kextends "Patient" | "Practitioner" | "RelatedPerson" | "AccessPolicy" | "Account" | "ActivityDefinition" | "AdverseEvent" | "AllergyIntolerance" | "Appointment" | "AppointmentResponse" | "AuditEvent" | "Basic" | "Binary" | "BiologicallyDerivedProduct" | "BodyStructure" | "Bot" | "Bundle" | "CapabilityStatement" | "CarePlan" | "CareTeam" | "CatalogEntry" | "ChargeItem" | "ChargeItemDefinition" | "Claim" | "ClaimResponse" | "ClientApplication" | "ClinicalImpression" | "CodeSystem" | "Communication" | "CommunicationRequest" | "CompartmentDefinition" | "Composition" | "ConceptMap" | "Condition" | "Consent" | "Contract" | "Coverage" | "CoverageEligibilityRequest" | "CoverageEligibilityResponse" | "DetectedIssue" | "Device" | "DeviceDefinition" | "DeviceMetric" | "DeviceRequest" | "DeviceUseStatement" | "DiagnosticReport" | "DocumentManifest" | "DocumentReference" | "EffectEvidenceSynthesis" | "Encounter" | "Endpoint" | "EnrollmentRequest" | "EnrollmentResponse" | "EpisodeOfCare" | "EventDefinition" | "Evidence" | "EvidenceVariable" | "ExampleScenario" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "GraphDefinition" | "Group" | "GuidanceResponse" | "HealthcareService" | "ImagingStudy" | "Immunization" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "ImplementationGuide" | "InsurancePlan" | "Invoice" | "JsonWebKey" | "Library" | "Linkage" | "List" | "Location" | "Login" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationRequest" | "MedicationStatement" | "MedicinalProduct" | "MedicinalProductAuthorization" | "MedicinalProductContraindication" | "MedicinalProductIndication" | "MedicinalProductIngredient" | "MedicinalProductInteraction" | "MedicinalProductManufactured" | "MedicinalProductPackaged" | "MedicinalProductPharmaceutical" | "MedicinalProductUndesirableEffect" | "MessageDefinition" | "MessageHeader" | "MolecularSequence" | "NamingSystem" | "NutritionOrder" | "Observation" | "ObservationDefinition" | "OperationDefinition" | "OperationOutcome" | "Organization" | "OrganizationAffiliation" | "Parameters" | "PasswordChangeRequest" | "PaymentNotice" | "PaymentReconciliation" | "Person" | "PlanDefinition" | "PractitionerRole" | "Procedure" | "Project" | "ProjectMembership" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RequestGroup" | "ResearchDefinition" | "ResearchElementDefinition" | "ResearchStudy" | "ResearchSubject" | "RiskAssessment" | "RiskEvidenceSynthesis" | "Schedule" | "SearchParameter" | "ServiceRequest" | "Slot" | "Specimen" | "SpecimenDefinition" | "StructureDefinition" | "StructureMap" | "Subscription" | "Substance" | "SubstanceNucleicAcid" | "SubstancePolymer" | "SubstanceProtein" | "SubstanceReferenceInformation" | "SubstanceSourceMaterial" | "SubstanceSpecification" | "SupplyDelivery" | "SupplyRequest" | "Task" | "TerminologyCapabilities" | "TestReport" | "TestScript" | "User" | "UserConfiguration" | "ValueSet" | "VerificationResult" | "VisionPrescription"

Parameters

NameTypeDescription
resourceTypeKThe FHIR resource type.
idstringThe resource ID.
vidstring-
optionsRequestInit-

Returns

ReadablePromise<ExtractResource<K>>

The resource if available; undefined otherwise.

Defined in

packages/core/src/client.ts:1121


readPatientEverything

readPatientEverything(id, options?): ReadablePromise<Bundle<Resource>>

Parameters

NameTypeDescription
idstringThe Patient Id
optionsRequestInit-

Returns

ReadablePromise<Bundle<Resource>>

A Bundle of all Resources related to the Patient

Defined in

packages/core/src/client.ts:1136


graphql

graphql(query, operationName?, variables?, options?): Promise<any>

Executes a GraphQL query.

Example:

const result = await medplum.graphql(`{
Patient(id: "123") {
resourceType
id
name {
given
family
}
}
}`);

Advanced queries such as named operations and variable substitution are supported:

const result = await medplum.graphql(
`query GetPatientById($patientId: ID!) {
Patient(id: $patientId) {
resourceType
id
name {
given
family
}
}
}`,
'GetPatientById',
{ patientId: '123' }
);

See the GraphQL documentation for more details: https://graphql.org/learn/

See the FHIR GraphQL documentation for FHIR specific details: https://www.hl7.org/fhir/graphql.html

Parameters

NameTypeDescription
querystringThe GraphQL query.
operationName?null | stringOptional GraphQL operation name.
variables?anyOptional GraphQL variables.
options?RequestInitOptional fetch options.

Returns

Promise<any>

The GraphQL result.

Defined in

packages/core/src/client.ts:1560


readResourceGraph

readResourceGraph<K>(resourceType, id, graphName): ReadablePromise<Bundle<Resource>>

Executes the $graph operation on this resource to fetch a Bundle of resources linked to the target resource according to a graph definition

Type parameters

NameType
Kextends "Patient" | "Practitioner" | "RelatedPerson" | "AccessPolicy" | "Account" | "ActivityDefinition" | "AdverseEvent" | "AllergyIntolerance" | "Appointment" | "AppointmentResponse" | "AuditEvent" | "Basic" | "Binary" | "BiologicallyDerivedProduct" | "BodyStructure" | "Bot" | "Bundle" | "CapabilityStatement" | "CarePlan" | "CareTeam" | "CatalogEntry" | "ChargeItem" | "ChargeItemDefinition" | "Claim" | "ClaimResponse" | "ClientApplication" | "ClinicalImpression" | "CodeSystem" | "Communication" | "CommunicationRequest" | "CompartmentDefinition" | "Composition" | "ConceptMap" | "Condition" | "Consent" | "Contract" | "Coverage" | "CoverageEligibilityRequest" | "CoverageEligibilityResponse" | "DetectedIssue" | "Device" | "DeviceDefinition" | "DeviceMetric" | "DeviceRequest" | "DeviceUseStatement" | "DiagnosticReport" | "DocumentManifest" | "DocumentReference" | "EffectEvidenceSynthesis" | "Encounter" | "Endpoint" | "EnrollmentRequest" | "EnrollmentResponse" | "EpisodeOfCare" | "EventDefinition" | "Evidence" | "EvidenceVariable" | "ExampleScenario" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "GraphDefinition" | "Group" | "GuidanceResponse" | "HealthcareService" | "ImagingStudy" | "Immunization" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "ImplementationGuide" | "InsurancePlan" | "Invoice" | "JsonWebKey" | "Library" | "Linkage" | "List" | "Location" | "Login" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationRequest" | "MedicationStatement" | "MedicinalProduct" | "MedicinalProductAuthorization" | "MedicinalProductContraindication" | "MedicinalProductIndication" | "MedicinalProductIngredient" | "MedicinalProductInteraction" | "MedicinalProductManufactured" | "MedicinalProductPackaged" | "MedicinalProductPharmaceutical" | "MedicinalProductUndesirableEffect" | "MessageDefinition" | "MessageHeader" | "MolecularSequence" | "NamingSystem" | "NutritionOrder" | "Observation" | "ObservationDefinition" | "OperationDefinition" | "OperationOutcome" | "Organization" | "OrganizationAffiliation" | "Parameters" | "PasswordChangeRequest" | "PaymentNotice" | "PaymentReconciliation" | "Person" | "PlanDefinition" | "PractitionerRole" | "Procedure" | "Project" | "ProjectMembership" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RequestGroup" | "ResearchDefinition" | "ResearchElementDefinition" | "ResearchStudy" | "ResearchSubject" | "RiskAssessment" | "RiskEvidenceSynthesis" | "Schedule" | "SearchParameter" | "ServiceRequest" | "Slot" | "Specimen" | "SpecimenDefinition" | "StructureDefinition" | "StructureMap" | "Subscription" | "Substance" | "SubstanceNucleicAcid" | "SubstancePolymer" | "SubstanceProtein" | "SubstanceReferenceInformation" | "SubstanceSourceMaterial" | "SubstanceSpecification" | "SupplyDelivery" | "SupplyRequest" | "Task" | "TerminologyCapabilities" | "TestReport" | "TestScript" | "User" | "UserConfiguration" | "ValueSet" | "VerificationResult" | "VisionPrescription"

Parameters

NameTypeDescription
resourceTypeKThe FHIR resource type.
idstringThe resource ID.
graphNamestringname parameter of the GraphDefinition

Returns

ReadablePromise<Bundle<Resource>>

A Bundle

Defined in

packages/core/src/client.ts:1575


download

download(url, options?): Promise<Blob>

Downloads the URL as a blob.

Parameters

NameTypeDescription
urlstring | URLThe URL to request.
optionsRequestInit-

Returns

Promise<Blob>

Promise to the response body as a blob.

Defined in

packages/core/src/client.ts:1690

Write

updateResource

updateResource<T>(resource): Promise<T>

Updates a FHIR resource.

The return value is the updated resource, including the ID and meta.

Example:

const result = await medplum.updateResource({
resourceType: 'Patient',
id: '123',
name: [{
family: 'Smith',
given: ['John']
}]
});
console.log(result.meta.versionId);

See the FHIR "update" operation for full details: https://www.hl7.org/fhir/http.html#update

Type parameters

NameType
Textends Resource

Parameters

NameTypeDescription
resourceTThe FHIR resource to update.

Returns

Promise<T>

The result of the update operation.

Defined in

packages/core/src/client.ts:1352


patchResource

patchResource<K>(resourceType, id, operations): Promise<ExtractResource<K>>

Updates a FHIR resource using JSONPatch operations.

The return value is the updated resource, including the ID and meta.

Example:

const result = await medplum.patchResource('Patient', '123', [
{op: 'replace', path: '/name/0/family', value: 'Smith'},
]);
console.log(result.meta.versionId);

See the FHIR "update" operation for full details: https://www.hl7.org/fhir/http.html#patch

See the JSONPatch specification for full details: https://tools.ietf.org/html/rfc6902

Type parameters

NameType
Kextends "Patient" | "Practitioner" | "RelatedPerson" | "AccessPolicy" | "Account" | "ActivityDefinition" | "AdverseEvent" | "AllergyIntolerance" | "Appointment" | "AppointmentResponse" | "AuditEvent" | "Basic" | "Binary" | "BiologicallyDerivedProduct" | "BodyStructure" | "Bot" | "Bundle" | "CapabilityStatement" | "CarePlan" | "CareTeam" | "CatalogEntry" | "ChargeItem" | "ChargeItemDefinition" | "Claim" | "ClaimResponse" | "ClientApplication" | "ClinicalImpression" | "CodeSystem" | "Communication" | "CommunicationRequest" | "CompartmentDefinition" | "Composition" | "ConceptMap" | "Condition" | "Consent" | "Contract" | "Coverage" | "CoverageEligibilityRequest" | "CoverageEligibilityResponse" | "DetectedIssue" | "Device" | "DeviceDefinition" | "DeviceMetric" | "DeviceRequest" | "DeviceUseStatement" | "DiagnosticReport" | "DocumentManifest" | "DocumentReference" | "EffectEvidenceSynthesis" | "Encounter" | "Endpoint" | "EnrollmentRequest" | "EnrollmentResponse" | "EpisodeOfCare" | "EventDefinition" | "Evidence" | "EvidenceVariable" | "ExampleScenario" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "GraphDefinition" | "Group" | "GuidanceResponse" | "HealthcareService" | "ImagingStudy" | "Immunization" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "ImplementationGuide" | "InsurancePlan" | "Invoice" | "JsonWebKey" | "Library" | "Linkage" | "List" | "Location" | "Login" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationRequest" | "MedicationStatement" | "MedicinalProduct" | "MedicinalProductAuthorization" | "MedicinalProductContraindication" | "MedicinalProductIndication" | "MedicinalProductIngredient" | "MedicinalProductInteraction" | "MedicinalProductManufactured" | "MedicinalProductPackaged" | "MedicinalProductPharmaceutical" | "MedicinalProductUndesirableEffect" | "MessageDefinition" | "MessageHeader" | "MolecularSequence" | "NamingSystem" | "NutritionOrder" | "Observation" | "ObservationDefinition" | "OperationDefinition" | "OperationOutcome" | "Organization" | "OrganizationAffiliation" | "Parameters" | "PasswordChangeRequest" | "PaymentNotice" | "PaymentReconciliation" | "Person" | "PlanDefinition" | "PractitionerRole" | "Procedure" | "Project" | "ProjectMembership" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RequestGroup" | "ResearchDefinition" | "ResearchElementDefinition" | "ResearchStudy" | "ResearchSubject" | "RiskAssessment" | "RiskEvidenceSynthesis" | "Schedule" | "SearchParameter" | "ServiceRequest" | "Slot" | "Specimen" | "SpecimenDefinition" | "StructureDefinition" | "StructureMap" | "Subscription" | "Substance" | "SubstanceNucleicAcid" | "SubstancePolymer" | "SubstanceProtein" | "SubstanceReferenceInformation" | "SubstanceSourceMaterial" | "SubstanceSpecification" | "SupplyDelivery" | "SupplyRequest" | "Task" | "TerminologyCapabilities" | "TestReport" | "TestScript" | "User" | "UserConfiguration" | "ValueSet" | "VerificationResult" | "VisionPrescription"

Parameters

NameTypeDescription
resourceTypeKThe FHIR resource type.
idstringThe resource ID.
operationsPatchOperation[]The JSONPatch operations.

Returns

Promise<ExtractResource<K>>

The result of the patch operations.

Defined in

packages/core/src/client.ts:1390

Create

createResource

createResource<T>(resource): Promise<T>

Creates a new FHIR resource.

The return value is the newly created resource, including the ID and meta.

Example:

const result = await medplum.createResource({
resourceType: 'Patient',
name: [{
family: 'Smith',
given: ['John']
}]
});
console.log(result.id);

See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create

Type parameters

NameType
Textends Resource

Parameters

NameTypeDescription
resourceTThe FHIR resource to create.

Returns

Promise<T>

The result of the create operation.

Defined in

packages/core/src/client.ts:1164


createResourceIfNoneExist

createResourceIfNoneExist<T>(resource, query): Promise<T>

Conditionally create a new FHIR resource only if some equivalent resource does not already exist on the server.

The return value is the existing resource or the newly created resource, including the ID and meta.

Example:

const result = await medplum.createResourceIfNoneExist(
{
resourceType: 'Patient',
identifier: [{
system: 'http://example.com/mrn',
value: '123'
}]
name: [{
family: 'Smith',
given: ['John']
}]
},
'identifier=123'
);
console.log(result.id);

This method is syntactic sugar for:

return searchOne(resourceType, query) ?? createResource(resource);

The query parameter only contains the search parameters (what would be in the URL following the "?").

See the FHIR "conditional create" operation for full details: https://www.hl7.org/fhir/http.html#ccreate

Type parameters

NameType
Textends Resource

Parameters

NameTypeDescription
resourceTThe FHIR resource to create.
querystringThe search query for an equivalent resource (should not include resource type or "?").

Returns

Promise<T>

The result of the create operation.

Defined in

packages/core/src/client.ts:1212


createBinary

createBinary(data, filename, contentType): Promise<Binary>

Creates a FHIR Binary resource with the provided data content.

The return value is the newly created resource, including the ID and meta.

The data parameter can be a string or a File object.

A File object often comes from a <input type="file"> element.

Example:

const result = await medplum.createBinary(myFile, 'test.jpg', 'image/jpeg');
console.log(result.id);

See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create

Parameters

NameTypeDescription
datastring | Uint8Array | File | BlobThe binary data to upload.
filenameundefined | stringOptional filename for the binary.
contentTypestringContent type for the binary.

Returns

Promise<Binary>

The result of the create operation.

Defined in

packages/core/src/client.ts:1240


createComment

createComment(resource, text): Promise<Communication>

Creates a FHIR Communication resource with the provided data content.

This is a convenience method to handle commmon cases where a Communication resource is created with a payload.

Parameters

NameTypeDescription
resourceResourceThe FHIR resource to comment on.
textstringThe text of the comment.

Returns

Promise<Communication>

The result of the create operation.

Defined in

packages/core/src/client.ts:1297

Delete

deleteResource

deleteResource(resourceType, id): Promise<any>

Deletes a FHIR resource by resource type and ID.

Example:

await medplum.deleteResource('Patient', '123');

See the FHIR "delete" operation for full details: https://www.hl7.org/fhir/http.html#delete

Parameters

NameTypeDescription
resourceType"Patient" | "Practitioner" | "RelatedPerson" | "AccessPolicy" | "Account" | "ActivityDefinition" | "AdverseEvent" | "AllergyIntolerance" | "Appointment" | "AppointmentResponse" | "AuditEvent" | "Basic" | "Binary" | "BiologicallyDerivedProduct" | "BodyStructure" | "Bot" | "Bundle" | "CapabilityStatement" | "CarePlan" | "CareTeam" | "CatalogEntry" | "ChargeItem" | "ChargeItemDefinition" | "Claim" | "ClaimResponse" | "ClientApplication" | "ClinicalImpression" | "CodeSystem" | "Communication" | "CommunicationRequest" | "CompartmentDefinition" | "Composition" | "ConceptMap" | "Condition" | "Consent" | "Contract" | "Coverage" | "CoverageEligibilityRequest" | "CoverageEligibilityResponse" | "DetectedIssue" | "Device" | "DeviceDefinition" | "DeviceMetric" | "DeviceRequest" | "DeviceUseStatement" | "DiagnosticReport" | "DocumentManifest" | "DocumentReference" | "EffectEvidenceSynthesis" | "Encounter" | "Endpoint" | "EnrollmentRequest" | "EnrollmentResponse" | "EpisodeOfCare" | "EventDefinition" | "Evidence" | "EvidenceVariable" | "ExampleScenario" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "GraphDefinition" | "Group" | "GuidanceResponse" | "HealthcareService" | "ImagingStudy" | "Immunization" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "ImplementationGuide" | "InsurancePlan" | "Invoice" | "JsonWebKey" | "Library" | "Linkage" | "List" | "Location" | "Login" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationRequest" | "MedicationStatement" | "MedicinalProduct" | "MedicinalProductAuthorization" | "MedicinalProductContraindication" | "MedicinalProductIndication" | "MedicinalProductIngredient" | "MedicinalProductInteraction" | "MedicinalProductManufactured" | "MedicinalProductPackaged" | "MedicinalProductPharmaceutical" | "MedicinalProductUndesirableEffect" | "MessageDefinition" | "MessageHeader" | "MolecularSequence" | "NamingSystem" | "NutritionOrder" | "Observation" | "ObservationDefinition" | "OperationDefinition" | "OperationOutcome" | "Organization" | "OrganizationAffiliation" | "Parameters" | "PasswordChangeRequest" | "PaymentNotice" | "PaymentReconciliation" | "Person" | "PlanDefinition" | "PractitionerRole" | "Procedure" | "Project" | "ProjectMembership" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RequestGroup" | "ResearchDefinition" | "ResearchElementDefinition" | "ResearchStudy" | "ResearchSubject" | "RiskAssessment" | "RiskEvidenceSynthesis" | "Schedule" | "SearchParameter" | "ServiceRequest" | "Slot" | "Specimen" | "SpecimenDefinition" | "StructureDefinition" | "StructureMap" | "Subscription" | "Substance" | "SubstanceNucleicAcid" | "SubstancePolymer" | "SubstanceProtein" | "SubstanceReferenceInformation" | "SubstanceSourceMaterial" | "SubstanceSpecification" | "SupplyDelivery" | "SupplyRequest" | "Task" | "TerminologyCapabilities" | "TestReport" | "TestScript" | "User" | "UserConfiguration" | "ValueSet" | "VerificationResult" | "VisionPrescription"The FHIR resource type.
idstringThe resource ID.

Returns

Promise<any>

The result of the delete operation.

Defined in

packages/core/src/client.ts:1415

Media

createPdf

createPdf(docDefinition, filename?, tableLayouts?, fonts?): Promise<Binary>

Creates a PDF as a FHIR Binary resource based on pdfmake document definition.

The return value is the newly created resource, including the ID and meta.

The docDefinition parameter is a pdfmake document definition.

Example:

const result = await medplum.createPdf({
content: ['Hello world']
});
console.log(result.id);

See the pdfmake document definition for full details: https://pdfmake.github.io/docs/0.1/document-definition-object/

Parameters

NameTypeDescription
docDefinitionTDocumentDefinitionsThe PDF document definition.
filename?string-
tableLayouts?Object-
fonts?TFontDictionary-

Returns

Promise<Binary>

The result of the create operation.

Defined in

packages/core/src/client.ts:1274


sendEmail

sendEmail(email): Promise<OperationOutcome>

Sends an email using the Medplum Email API.

Builds the email using nodemailer MailComposer.

Examples:

Send a simple text email:

await medplum.sendEmail({
to: 'alice@example.com',
cc: 'bob@example.com',
subject: 'Hello',
text: 'Hello Alice',
});

Send an email with a Binary attachment:

await medplum.sendEmail({
to: 'alice@example.com',
subject: 'Email with attachment',
text: 'See the attached report',
attachments: [{
filename: 'report.pdf',
path: "Binary/" + binary.id
}]
});

See options here: https://nodemailer.com/extras/mailcomposer/

Parameters

NameType
emailMailOptions

Returns

Promise<OperationOutcome>

Promise to the operation outcome.

Defined in

packages/core/src/client.ts:1508

Authentication

clear

clear(): void

Clears all auth state including local storage and session storage.

Returns

void

Defined in

packages/core/src/client.ts:465


startNewUser

startNewUser(newUserRequest): Promise<LoginAuthenticationResponse>

Initiates a new user flow.

This method is part of the two different user registration flows: 1) New Practitioner and new Project 2) New Patient registration

Parameters

NameTypeDescription
newUserRequestNewUserRequestRegister request including email and password.

Returns

Promise<LoginAuthenticationResponse>

Promise to the authentication response.

Defined in

packages/core/src/client.ts:625


startLogin

startLogin(loginRequest): Promise<LoginAuthenticationResponse>

Initiates a user login flow.

Parameters

NameTypeDescription
loginRequestLoginRequestLogin request including email and password.

Returns

Promise<LoginAuthenticationResponse>

Promise to the authentication response.

Defined in

packages/core/src/client.ts:664


startGoogleLogin

startGoogleLogin(loginRequest): Promise<LoginAuthenticationResponse>

Tries to sign in with Google authentication. The response parameter is the result of a Google authentication. See: https://developers.google.com/identity/gsi/web/guides/handle-credential-responses-js-functions

Parameters

NameTypeDescription
loginRequestGoogleLoginRequestLogin request including Google credential response.

Returns

Promise<LoginAuthenticationResponse>

Promise to the authentication response.

Defined in

packages/core/src/client.ts:683


signOut

signOut(): void

Signs out locally. Does not invalidate tokens with the server.

Returns

void

Defined in

packages/core/src/client.ts:721


signInWithRedirect

signInWithRedirect(): Promise<void | ProfileResource>

Tries to sign in the user. Returns true if the user is signed in. This may result in navigating away to the sign in page.

Returns

Promise<void | ProfileResource>

Defined in

packages/core/src/client.ts:731


signOutWithRedirect

signOutWithRedirect(): void

Tries to sign out the user. See: https://docs.aws.amazon.com/cognito/latest/developerguide/logout-endpoint.html

Returns

void

Defined in

packages/core/src/client.ts:747


getActiveLogin

getActiveLogin(): undefined | LoginState

Returns

undefined | LoginState

The Login State

Defined in

packages/core/src/client.ts:1587


setActiveLogin

setActiveLogin(login): Promise<void>

Parameters

NameType
loginLoginState

Returns

Promise<void>

Defined in

packages/core/src/client.ts:1594


getAccessToken

getAccessToken(): undefined | string

Returns

undefined | string

Defined in

packages/core/src/client.ts:1609


setAccessToken

setAccessToken(accessToken): void

Parameters

NameType
accessTokenstring

Returns

void

Defined in

packages/core/src/client.ts:1616


getLogins

getLogins(): LoginState[]

Returns

LoginState[]

Defined in

packages/core/src/client.ts:1626


isLoading

isLoading(): boolean

Returns

boolean

Defined in

packages/core/src/client.ts:1655


startClientLogin

startClientLogin(clientId, clientSecret): Promise<ProfileResource>

Starts a new OAuth2 client credentials flow. See: https://datatracker.ietf.org/doc/html/rfc6749#section-4.4

Parameters

NameTypeDescription
clientIdstringThe client ID.
clientSecretstringThe client secret.

Returns

Promise<ProfileResource>

Promise that resolves to the client profile.

Defined in

packages/core/src/client.ts:1934

fhirSearchUrl

fhirSearchUrl(resourceType, query): URL

Builds a FHIR search URL from a search query or structured query object.

Parameters

NameTypeDescription
resourceType"Patient" | "Practitioner" | "RelatedPerson" | "AccessPolicy" | "Account" | "ActivityDefinition" | "AdverseEvent" | "AllergyIntolerance" | "Appointment" | "AppointmentResponse" | "AuditEvent" | "Basic" | "Binary" | "BiologicallyDerivedProduct" | "BodyStructure" | "Bot" | "Bundle" | "CapabilityStatement" | "CarePlan" | "CareTeam" | "CatalogEntry" | "ChargeItem" | "ChargeItemDefinition" | "Claim" | "ClaimResponse" | "ClientApplication" | "ClinicalImpression" | "CodeSystem" | "Communication" | "CommunicationRequest" | "CompartmentDefinition" | "Composition" | "ConceptMap" | "Condition" | "Consent" | "Contract" | "Coverage" | "CoverageEligibilityRequest" | "CoverageEligibilityResponse" | "DetectedIssue" | "Device" | "DeviceDefinition" | "DeviceMetric" | "DeviceRequest" | "DeviceUseStatement" | "DiagnosticReport" | "DocumentManifest" | "DocumentReference" | "EffectEvidenceSynthesis" | "Encounter" | "Endpoint" | "EnrollmentRequest" | "EnrollmentResponse" | "EpisodeOfCare" | "EventDefinition" | "Evidence" | "EvidenceVariable" | "ExampleScenario" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "GraphDefinition" | "Group" | "GuidanceResponse" | "HealthcareService" | "ImagingStudy" | "Immunization" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "ImplementationGuide" | "InsurancePlan" | "Invoice" | "JsonWebKey" | "Library" | "Linkage" | "List" | "Location" | "Login" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationRequest" | "MedicationStatement" | "MedicinalProduct" | "MedicinalProductAuthorization" | "MedicinalProductContraindication" | "MedicinalProductIndication" | "MedicinalProductIngredient" | "MedicinalProductInteraction" | "MedicinalProductManufactured" | "MedicinalProductPackaged" | "MedicinalProductPharmaceutical" | "MedicinalProductUndesirableEffect" | "MessageDefinition" | "MessageHeader" | "MolecularSequence" | "NamingSystem" | "NutritionOrder" | "Observation" | "ObservationDefinition" | "OperationDefinition" | "OperationOutcome" | "Organization" | "OrganizationAffiliation" | "Parameters" | "PasswordChangeRequest" | "PaymentNotice" | "PaymentReconciliation" | "Person" | "PlanDefinition" | "PractitionerRole" | "Procedure" | "Project" | "ProjectMembership" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RequestGroup" | "ResearchDefinition" | "ResearchElementDefinition" | "ResearchStudy" | "ResearchSubject" | "RiskAssessment" | "RiskEvidenceSynthesis" | "Schedule" | "SearchParameter" | "ServiceRequest" | "Slot" | "Specimen" | "SpecimenDefinition" | "StructureDefinition" | "StructureMap" | "Subscription" | "Substance" | "SubstanceNucleicAcid" | "SubstancePolymer" | "SubstanceProtein" | "SubstanceReferenceInformation" | "SubstanceSourceMaterial" | "SubstanceSpecification" | "SupplyDelivery" | "SupplyRequest" | "Task" | "TerminologyCapabilities" | "TestReport" | "TestScript" | "User" | "UserConfiguration" | "ValueSet" | "VerificationResult" | "VisionPrescription"-
queryundefined | string | URLSearchParamsThe FHIR search query or structured query object.

Returns

URL

The well-formed FHIR URL.

Defined in

packages/core/src/client.ts:769


search

search<K>(resourceType, query?, options?): ReadablePromise<Bundle<ExtractResource<K>>>

Sends a FHIR search request.

Example using a FHIR search string:

const bundle = await client.search('Patient', 'name=Alice');
console.log(bundle);

The return value is a FHIR bundle:

{
"resourceType": "Bundle",
"type": "searchset",
"total": 1,
"entry": [
{
"resource": {
"resourceType": "Patient",
"name": [
{
"given": [
"George"
],
"family": "Washington"
}
],
}
}
]
}

See FHIR search for full details: https://www.hl7.org/fhir/search.html

Type parameters

NameType
Kextends "Patient" | "Practitioner" | "RelatedPerson" | "AccessPolicy" | "Account" | "ActivityDefinition" | "AdverseEvent" | "AllergyIntolerance" | "Appointment" | "AppointmentResponse" | "AuditEvent" | "Basic" | "Binary" | "BiologicallyDerivedProduct" | "BodyStructure" | "Bot" | "Bundle" | "CapabilityStatement" | "CarePlan" | "CareTeam" | "CatalogEntry" | "ChargeItem" | "ChargeItemDefinition" | "Claim" | "ClaimResponse" | "ClientApplication" | "ClinicalImpression" | "CodeSystem" | "Communication" | "CommunicationRequest" | "CompartmentDefinition" | "Composition" | "ConceptMap" | "Condition" | "Consent" | "Contract" | "Coverage" | "CoverageEligibilityRequest" | "CoverageEligibilityResponse" | "DetectedIssue" | "Device" | "DeviceDefinition" | "DeviceMetric" | "DeviceRequest" | "DeviceUseStatement" | "DiagnosticReport" | "DocumentManifest" | "DocumentReference" | "EffectEvidenceSynthesis" | "Encounter" | "Endpoint" | "EnrollmentRequest" | "EnrollmentResponse" | "EpisodeOfCare" | "EventDefinition" | "Evidence" | "EvidenceVariable" | "ExampleScenario" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "GraphDefinition" | "Group" | "GuidanceResponse" | "HealthcareService" | "ImagingStudy" | "Immunization" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "ImplementationGuide" | "InsurancePlan" | "Invoice" | "JsonWebKey" | "Library" | "Linkage" | "List" | "Location" | "Login" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationRequest" | "MedicationStatement" | "MedicinalProduct" | "MedicinalProductAuthorization" | "MedicinalProductContraindication" | "MedicinalProductIndication" | "MedicinalProductIngredient" | "MedicinalProductInteraction" | "MedicinalProductManufactured" | "MedicinalProductPackaged" | "MedicinalProductPharmaceutical" | "MedicinalProductUndesirableEffect" | "MessageDefinition" | "MessageHeader" | "MolecularSequence" | "NamingSystem" | "NutritionOrder" | "Observation" | "ObservationDefinition" | "OperationDefinition" | "OperationOutcome" | "Organization" | "OrganizationAffiliation" | "Parameters" | "PasswordChangeRequest" | "PaymentNotice" | "PaymentReconciliation" | "Person" | "PlanDefinition" | "PractitionerRole" | "Procedure" | "Project" | "ProjectMembership" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RequestGroup" | "ResearchDefinition" | "ResearchElementDefinition" | "ResearchStudy" | "ResearchSubject" | "RiskAssessment" | "RiskEvidenceSynthesis" | "Schedule" | "SearchParameter" | "ServiceRequest" | "Slot" | "Specimen" | "SpecimenDefinition" | "StructureDefinition" | "StructureMap" | "Subscription" | "Substance" | "SubstanceNucleicAcid" | "SubstancePolymer" | "SubstanceProtein" | "SubstanceReferenceInformation" | "SubstanceSourceMaterial" | "SubstanceSpecification" | "SupplyDelivery" | "SupplyRequest" | "Task" | "TerminologyCapabilities" | "TestReport" | "TestScript" | "User" | "UserConfiguration" | "ValueSet" | "VerificationResult" | "VisionPrescription"

Parameters

NameTypeDescription
resourceTypeK-
query?string | URLSearchParamsThe search query as either a string or a structured search object.
optionsRequestInit-

Returns

ReadablePromise<Bundle<ExtractResource<K>>>

Promise to the search result bundle.

Defined in

packages/core/src/client.ts:818


searchOne

searchOne<K>(resourceType, query?, options?): ReadablePromise<undefined | ExtractResource<K>>

Sends a FHIR search request for a single resource.

This is a convenience method for search() that returns the first resource rather than a Bundle.

Example using a FHIR search string:

const patient = await client.searchOne('Patient', 'identifier=123');
console.log(patient);

The return value is the resource, if available; otherwise, undefined.

See FHIR search for full details: https://www.hl7.org/fhir/search.html

Type parameters

NameType
Kextends "Patient" | "Practitioner" | "RelatedPerson" | "AccessPolicy" | "Account" | "ActivityDefinition" | "AdverseEvent" | "AllergyIntolerance" | "Appointment" | "AppointmentResponse" | "AuditEvent" | "Basic" | "Binary" | "BiologicallyDerivedProduct" | "BodyStructure" | "Bot" | "Bundle" | "CapabilityStatement" | "CarePlan" | "CareTeam" | "CatalogEntry" | "ChargeItem" | "ChargeItemDefinition" | "Claim" | "ClaimResponse" | "ClientApplication" | "ClinicalImpression" | "CodeSystem" | "Communication" | "CommunicationRequest" | "CompartmentDefinition" | "Composition" | "ConceptMap" | "Condition" | "Consent" | "Contract" | "Coverage" | "CoverageEligibilityRequest" | "CoverageEligibilityResponse" | "DetectedIssue" | "Device" | "DeviceDefinition" | "DeviceMetric" | "DeviceRequest" | "DeviceUseStatement" | "DiagnosticReport" | "DocumentManifest" | "DocumentReference" | "EffectEvidenceSynthesis" | "Encounter" | "Endpoint" | "EnrollmentRequest" | "EnrollmentResponse" | "EpisodeOfCare" | "EventDefinition" | "Evidence" | "EvidenceVariable" | "ExampleScenario" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "GraphDefinition" | "Group" | "GuidanceResponse" | "HealthcareService" | "ImagingStudy" | "Immunization" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "ImplementationGuide" | "InsurancePlan" | "Invoice" | "JsonWebKey" | "Library" | "Linkage" | "List" | "Location" | "Login" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationRequest" | "MedicationStatement" | "MedicinalProduct" | "MedicinalProductAuthorization" | "MedicinalProductContraindication" | "MedicinalProductIndication" | "MedicinalProductIngredient" | "MedicinalProductInteraction" | "MedicinalProductManufactured" | "MedicinalProductPackaged" | "MedicinalProductPharmaceutical" | "MedicinalProductUndesirableEffect" | "MessageDefinition" | "MessageHeader" | "MolecularSequence" | "NamingSystem" | "NutritionOrder" | "Observation" | "ObservationDefinition" | "OperationDefinition" | "OperationOutcome" | "Organization" | "OrganizationAffiliation" | "Parameters" | "PasswordChangeRequest" | "PaymentNotice" | "PaymentReconciliation" | "Person" | "PlanDefinition" | "PractitionerRole" | "Procedure" | "Project" | "ProjectMembership" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RequestGroup" | "ResearchDefinition" | "ResearchElementDefinition" | "ResearchStudy" | "ResearchSubject" | "RiskAssessment" | "RiskEvidenceSynthesis" | "Schedule" | "SearchParameter" | "ServiceRequest" | "Slot" | "Specimen" | "SpecimenDefinition" | "StructureDefinition" | "StructureMap" | "Subscription" | "Substance" | "SubstanceNucleicAcid" | "SubstancePolymer" | "SubstanceProtein" | "SubstanceReferenceInformation" | "SubstanceSourceMaterial" | "SubstanceSpecification" | "SupplyDelivery" | "SupplyRequest" | "Task" | "TerminologyCapabilities" | "TestReport" | "TestScript" | "User" | "UserConfiguration" | "ValueSet" | "VerificationResult" | "VisionPrescription"

Parameters

NameTypeDescription
resourceTypeK-
query?string | URLSearchParamsThe search query as either a string or a structured search object.
optionsRequestInit-

Returns

ReadablePromise<undefined | ExtractResource<K>>

Promise to the search result bundle.

Defined in

packages/core/src/client.ts:846


searchResources

searchResources<K>(resourceType, query?, options?): ReadablePromise<ExtractResource<K>[]>

Sends a FHIR search request for an array of resources.

This is a convenience method for search() that returns the resources as an array rather than a Bundle.

Example using a FHIR search string:

const patients = await client.searchResources('Patient', 'name=Alice');
console.log(patients);

The return value is an array of resources.

See FHIR search for full details: https://www.hl7.org/fhir/search.html

Type parameters

NameType
Kextends "Patient" | "Practitioner" | "RelatedPerson" | "AccessPolicy" | "Account" | "ActivityDefinition" | "AdverseEvent" | "AllergyIntolerance" | "Appointment" | "AppointmentResponse" | "AuditEvent" | "Basic" | "Binary" | "BiologicallyDerivedProduct" | "BodyStructure" | "Bot" | "Bundle" | "CapabilityStatement" | "CarePlan" | "CareTeam" | "CatalogEntry" | "ChargeItem" | "ChargeItemDefinition" | "Claim" | "ClaimResponse" | "ClientApplication" | "ClinicalImpression" | "CodeSystem" | "Communication" | "CommunicationRequest" | "CompartmentDefinition" | "Composition" | "ConceptMap" | "Condition" | "Consent" | "Contract" | "Coverage" | "CoverageEligibilityRequest" | "CoverageEligibilityResponse" | "DetectedIssue" | "Device" | "DeviceDefinition" | "DeviceMetric" | "DeviceRequest" | "DeviceUseStatement" | "DiagnosticReport" | "DocumentManifest" | "DocumentReference" | "EffectEvidenceSynthesis" | "Encounter" | "Endpoint" | "EnrollmentRequest" | "EnrollmentResponse" | "EpisodeOfCare" | "EventDefinition" | "Evidence" | "EvidenceVariable" | "ExampleScenario" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "GraphDefinition" | "Group" | "GuidanceResponse" | "HealthcareService" | "ImagingStudy" | "Immunization" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "ImplementationGuide" | "InsurancePlan" | "Invoice" | "JsonWebKey" | "Library" | "Linkage" | "List" | "Location" | "Login" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationRequest" | "MedicationStatement" | "MedicinalProduct" | "MedicinalProductAuthorization" | "MedicinalProductContraindication" | "MedicinalProductIndication" | "MedicinalProductIngredient" | "MedicinalProductInteraction" | "MedicinalProductManufactured" | "MedicinalProductPackaged" | "MedicinalProductPharmaceutical" | "MedicinalProductUndesirableEffect" | "MessageDefinition" | "MessageHeader" | "MolecularSequence" | "NamingSystem" | "NutritionOrder" | "Observation" | "ObservationDefinition" | "OperationDefinition" | "OperationOutcome" | "Organization" | "OrganizationAffiliation" | "Parameters" | "PasswordChangeRequest" | "PaymentNotice" | "PaymentReconciliation" | "Person" | "PlanDefinition" | "PractitionerRole" | "Procedure" | "Project" | "ProjectMembership" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RequestGroup" | "ResearchDefinition" | "ResearchElementDefinition" | "ResearchStudy" | "ResearchSubject" | "RiskAssessment" | "RiskEvidenceSynthesis" | "Schedule" | "SearchParameter" | "ServiceRequest" | "Slot" | "Specimen" | "SpecimenDefinition" | "StructureDefinition" | "StructureMap" | "Subscription" | "Substance" | "SubstanceNucleicAcid" | "SubstancePolymer" | "SubstanceProtein" | "SubstanceReferenceInformation" | "SubstanceSourceMaterial" | "SubstanceSpecification" | "SupplyDelivery" | "SupplyRequest" | "Task" | "TerminologyCapabilities" | "TestReport" | "TestScript" | "User" | "UserConfiguration" | "ValueSet" | "VerificationResult" | "VisionPrescription"

Parameters

NameTypeDescription
resourceTypeK-
query?string | URLSearchParamsThe search query as either a string or a structured search object.
optionsRequestInit-

Returns

ReadablePromise<ExtractResource<K>[]>

Promise to the search result bundle.

Defined in

packages/core/src/client.ts:886


searchValueSet

searchValueSet(system, filter, options?): ReadablePromise<ValueSet>

Searches a ValueSet resource using the "expand" operation. See: https://www.hl7.org/fhir/operation-valueset-expand.html

Parameters

NameTypeDescription
systemstringThe ValueSet system url.
filterstringThe search string.
optionsRequestInit-

Returns

ReadablePromise<ValueSet>

Promise to expanded ValueSet.

Defined in

packages/core/src/client.ts:915

Caching

invalidateUrl

invalidateUrl(url): void

Invalidates any cached values or cached requests for the given URL.

Parameters

NameTypeDescription
urlstring | URLThe URL to invalidate.

Returns

void

Defined in

packages/core/src/client.ts:480


invalidateSearches

invalidateSearches<K>(resourceType): void

Invalidates all cached search results or cached requests for the given resourceType.

Type parameters

NameType
Kextends "Patient" | "Practitioner" | "RelatedPerson" | "AccessPolicy" | "Account" | "ActivityDefinition" | "AdverseEvent" | "AllergyIntolerance" | "Appointment" | "AppointmentResponse" | "AuditEvent" | "Basic" | "Binary" | "BiologicallyDerivedProduct" | "BodyStructure" | "Bot" | "Bundle" | "CapabilityStatement" | "CarePlan" | "CareTeam" | "CatalogEntry" | "ChargeItem" | "ChargeItemDefinition" | "Claim" | "ClaimResponse" | "ClientApplication" | "ClinicalImpression" | "CodeSystem" | "Communication" | "CommunicationRequest" | "CompartmentDefinition" | "Composition" | "ConceptMap" | "Condition" | "Consent" | "Contract" | "Coverage" | "CoverageEligibilityRequest" | "CoverageEligibilityResponse" | "DetectedIssue" | "Device" | "DeviceDefinition" | "DeviceMetric" | "DeviceRequest" | "DeviceUseStatement" | "DiagnosticReport" | "DocumentManifest" | "DocumentReference" | "EffectEvidenceSynthesis" | "Encounter" | "Endpoint" | "EnrollmentRequest" | "EnrollmentResponse" | "EpisodeOfCare" | "EventDefinition" | "Evidence" | "EvidenceVariable" | "ExampleScenario" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "GraphDefinition" | "Group" | "GuidanceResponse" | "HealthcareService" | "ImagingStudy" | "Immunization" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "ImplementationGuide" | "InsurancePlan" | "Invoice" | "JsonWebKey" | "Library" | "Linkage" | "List" | "Location" | "Login" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationRequest" | "MedicationStatement" | "MedicinalProduct" | "MedicinalProductAuthorization" | "MedicinalProductContraindication" | "MedicinalProductIndication" | "MedicinalProductIngredient" | "MedicinalProductInteraction" | "MedicinalProductManufactured" | "MedicinalProductPackaged" | "MedicinalProductPharmaceutical" | "MedicinalProductUndesirableEffect" | "MessageDefinition" | "MessageHeader" | "MolecularSequence" | "NamingSystem" | "NutritionOrder" | "Observation" | "ObservationDefinition" | "OperationDefinition" | "OperationOutcome" | "Organization" | "OrganizationAffiliation" | "Parameters" | "PasswordChangeRequest" | "PaymentNotice" | "PaymentReconciliation" | "Person" | "PlanDefinition" | "PractitionerRole" | "Procedure" | "Project" | "ProjectMembership" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RequestGroup" | "ResearchDefinition" | "ResearchElementDefinition" | "ResearchStudy" | "ResearchSubject" | "RiskAssessment" | "RiskEvidenceSynthesis" | "Schedule" | "SearchParameter" | "ServiceRequest" | "Slot" | "Specimen" | "SpecimenDefinition" | "StructureDefinition" | "StructureMap" | "Subscription" | "Substance" | "SubstanceNucleicAcid" | "SubstancePolymer" | "SubstanceProtein" | "SubstanceReferenceInformation" | "SubstanceSourceMaterial" | "SubstanceSpecification" | "SupplyDelivery" | "SupplyRequest" | "Task" | "TerminologyCapabilities" | "TestReport" | "TestScript" | "User" | "UserConfiguration" | "ValueSet" | "VerificationResult" | "VisionPrescription"

Parameters

NameTypeDescription
resourceTypeKThe resource type to invalidate.

Returns

void

Defined in

packages/core/src/client.ts:490


getCached

getCached<K>(resourceType, id): undefined | ExtractResource<K>

Returns a cached resource if it is available.

Type parameters

NameType
Kextends "Patient" | "Practitioner" | "RelatedPerson" | "AccessPolicy" | "Account" | "ActivityDefinition" | "AdverseEvent" | "AllergyIntolerance" | "Appointment" | "AppointmentResponse" | "AuditEvent" | "Basic" | "Binary" | "BiologicallyDerivedProduct" | "BodyStructure" | "Bot" | "Bundle" | "CapabilityStatement" | "CarePlan" | "CareTeam" | "CatalogEntry" | "ChargeItem" | "ChargeItemDefinition" | "Claim" | "ClaimResponse" | "ClientApplication" | "ClinicalImpression" | "CodeSystem" | "Communication" | "CommunicationRequest" | "CompartmentDefinition" | "Composition" | "ConceptMap" | "Condition" | "Consent" | "Contract" | "Coverage" | "CoverageEligibilityRequest" | "CoverageEligibilityResponse" | "DetectedIssue" | "Device" | "DeviceDefinition" | "DeviceMetric" | "DeviceRequest" | "DeviceUseStatement" | "DiagnosticReport" | "DocumentManifest" | "DocumentReference" | "EffectEvidenceSynthesis" | "Encounter" | "Endpoint" | "EnrollmentRequest" | "EnrollmentResponse" | "EpisodeOfCare" | "EventDefinition" | "Evidence" | "EvidenceVariable" | "ExampleScenario" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "GraphDefinition" | "Group" | "GuidanceResponse" | "HealthcareService" | "ImagingStudy" | "Immunization" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "ImplementationGuide" | "InsurancePlan" | "Invoice" | "JsonWebKey" | "Library" | "Linkage" | "List" | "Location" | "Login" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationRequest" | "MedicationStatement" | "MedicinalProduct" | "MedicinalProductAuthorization" | "MedicinalProductContraindication" | "MedicinalProductIndication" | "MedicinalProductIngredient" | "MedicinalProductInteraction" | "MedicinalProductManufactured" | "MedicinalProductPackaged" | "MedicinalProductPharmaceutical" | "MedicinalProductUndesirableEffect" | "MessageDefinition" | "MessageHeader" | "MolecularSequence" | "NamingSystem" | "NutritionOrder" | "Observation" | "ObservationDefinition" | "OperationDefinition" | "OperationOutcome" | "Organization" | "OrganizationAffiliation" | "Parameters" | "PasswordChangeRequest" | "PaymentNotice" | "PaymentReconciliation" | "Person" | "PlanDefinition" | "PractitionerRole" | "Procedure" | "Project" | "ProjectMembership" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RequestGroup" | "ResearchDefinition" | "ResearchElementDefinition" | "ResearchStudy" | "ResearchSubject" | "RiskAssessment" | "RiskEvidenceSynthesis" | "Schedule" | "SearchParameter" | "ServiceRequest" | "Slot" | "Specimen" | "SpecimenDefinition" | "StructureDefinition" | "StructureMap" | "Subscription" | "Substance" | "SubstanceNucleicAcid" | "SubstancePolymer" | "SubstanceProtein" | "SubstanceReferenceInformation" | "SubstanceSourceMaterial" | "SubstanceSpecification" | "SupplyDelivery" | "SupplyRequest" | "Task" | "TerminologyCapabilities" | "TestReport" | "TestScript" | "User" | "UserConfiguration" | "ValueSet" | "VerificationResult" | "VisionPrescription"

Parameters

NameTypeDescription
resourceTypeKThe FHIR resource type.
idstringThe FHIR resource ID.

Returns

undefined | ExtractResource<K>

The resource if it is available in the cache; undefined otherwise.

Defined in

packages/core/src/client.ts:929


getCachedReference

getCachedReference<T>(reference): undefined | T

Returns a cached resource if it is available.

Type parameters

NameType
Textends Resource

Parameters

NameType
referenceReference<T>

Returns

undefined | T

The resource if it is available in the cache; undefined otherwise.

Defined in

packages/core/src/client.ts:941

Batch

executeBatch

executeBatch(bundle): Promise<Bundle<Resource>>

Executes a batch or transaction of FHIR operations.

Example:

await medplum.executeBatch({
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"fullUrl": "urn:uuid:61ebe359-bfdc-4613-8bf2-c5e300945f0a",
"resource": {
"resourceType": "Patient",
"name": [{ "use": "official", "given": ["Alice"], "family": "Smith" }],
"gender": "female",
"birthDate": "1974-12-25"
},
"request": {
"method": "POST",
"url": "Patient"
}
},
{
"fullUrl": "urn:uuid:88f151c0-a954-468a-88bd-5ae15c08e059",
"resource": {
"resourceType": "Patient",
"identifier": [{ "system": "http:/example.org/fhir/ids", "value": "234234" }],
"name": [{ "use": "official", "given": ["Bob"], "family": "Jones" }],
"gender": "male",
"birthDate": "1974-12-25"
},
"request": {
"method": "POST",
"url": "Patient",
"ifNoneExist": "identifier=http:/example.org/fhir/ids|234234"
}
}
]
});

See The FHIR "batch/transaction" section for full details: https://hl7.org/fhir/http.html#transaction

Parameters

NameTypeDescription
bundleBundle<Resource>The FHIR batch/transaction bundle.

Returns

Promise<Bundle<Resource>>

The FHIR batch/transaction response bundle.

Defined in

packages/core/src/client.ts:1467

HTTP

getBaseUrl

getBaseUrl(): string

Returns the current base URL for all API requests. By default, this is set to https://api.medplum.com/. This can be overridden by setting the baseUrl option when creating the client.

Returns

string

The current base URL for all API requests.

Defined in

packages/core/src/client.ts:457


get

get<T>(url, options?): ReadablePromise<T>

Makes an HTTP GET request to the specified URL.

This is a lower level method for custom requests. For common operations, we recommend using higher level methods such as readResource(), search(), etc.

Type parameters

NameType
Tany

Parameters

NameTypeDescription
urlstring | URLThe target URL.
optionsRequestInitOptional fetch options.

Returns

ReadablePromise<T>

Promise to the response content.

Defined in

packages/core/src/client.ts:511


post

post(url, body, contentType?, options?): Promise<any>

Makes an HTTP POST request to the specified URL.

This is a lower level method for custom requests. For common operations, we recommend using higher level methods such as createResource().

Parameters

NameTypeDescription
urlstring | URLThe target URL.
bodyanyThe content body. Strings and File objects are passed directly. Other objects are converted to JSON.
contentType?stringThe content type to be included in the "Content-Type" header.
optionsRequestInitOptional fetch options.

Returns

Promise<any>

Promise to the response content.

Defined in

packages/core/src/client.ts:536


put

put(url, body, contentType?, options?): Promise<any>

Makes an HTTP PUT request to the specified URL.

This is a lower level method for custom requests. For common operations, we recommend using higher level methods such as updateResource().

Parameters

NameTypeDescription
urlstring | URLThe target URL.
bodyanyThe content body. Strings and File objects are passed directly. Other objects are converted to JSON.
contentType?stringThe content type to be included in the "Content-Type" header.
optionsRequestInitOptional fetch options.

Returns

Promise<any>

Promise to the response content.

Defined in

packages/core/src/client.ts:562


patch

patch(url, operations, options?): Promise<any>

Makes an HTTP PATCH request to the specified URL.

This is a lower level method for custom requests. For common operations, we recommend using higher level methods such as patchResource().

Parameters

NameTypeDescription
urlstring | URLThe target URL.
operationsPatchOperation[]Array of JSONPatch operations.
optionsRequestInitOptional fetch options.

Returns

Promise<any>

Promise to the response content.

Defined in

packages/core/src/client.ts:587


delete

delete(url, options?): Promise<any>

Makes an HTTP DELETE request to the specified URL.

This is a lower level method for custom requests. For common operations, we recommend using higher level methods such as deleteResource().

Parameters

NameTypeDescription
urlstring | URLThe target URL.
optionsRequestInitOptional fetch options.

Returns

Promise<any>

Promise to the response content.

Defined in

packages/core/src/client.ts:608


fhirUrl

fhirUrl(...path): URL

Builds a FHIR URL from a collection of URL path components. For example, buildUrl('/Patient', '123') returns fhir/R4/Patient/123.

Parameters

NameTypeDescription
...pathstring[]The path component of the URL.

Returns

URL

The well-formed FHIR URL.

Defined in

packages/core/src/client.ts:758


fhirSearchUrl

fhirSearchUrl(resourceType, query): URL

Builds a FHIR search URL from a search query or structured query object.

Parameters

NameTypeDescription
resourceType"Patient" | "Practitioner" | "RelatedPerson" | "AccessPolicy" | "Account" | "ActivityDefinition" | "AdverseEvent" | "AllergyIntolerance" | "Appointment" | "AppointmentResponse" | "AuditEvent" | "Basic" | "Binary" | "BiologicallyDerivedProduct" | "BodyStructure" | "Bot" | "Bundle" | "CapabilityStatement" | "CarePlan" | "CareTeam" | "CatalogEntry" | "ChargeItem" | "ChargeItemDefinition" | "Claim" | "ClaimResponse" | "ClientApplication" | "ClinicalImpression" | "CodeSystem" | "Communication" | "CommunicationRequest" | "CompartmentDefinition" | "Composition" | "ConceptMap" | "Condition" | "Consent" | "Contract" | "Coverage" | "CoverageEligibilityRequest" | "CoverageEligibilityResponse" | "DetectedIssue" | "Device" | "DeviceDefinition" | "DeviceMetric" | "DeviceRequest" | "DeviceUseStatement" | "DiagnosticReport" | "DocumentManifest" | "DocumentReference" | "EffectEvidenceSynthesis" | "Encounter" | "Endpoint" | "EnrollmentRequest" | "EnrollmentResponse" | "EpisodeOfCare" | "EventDefinition" | "Evidence" | "EvidenceVariable" | "ExampleScenario" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "GraphDefinition" | "Group" | "GuidanceResponse" | "HealthcareService" | "ImagingStudy" | "Immunization" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "ImplementationGuide" | "InsurancePlan" | "Invoice" | "JsonWebKey" | "Library" | "Linkage" | "List" | "Location" | "Login" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationRequest" | "MedicationStatement" | "MedicinalProduct" | "MedicinalProductAuthorization" | "MedicinalProductContraindication" | "MedicinalProductIndication" | "MedicinalProductIngredient" | "MedicinalProductInteraction" | "MedicinalProductManufactured" | "MedicinalProductPackaged" | "MedicinalProductPharmaceutical" | "MedicinalProductUndesirableEffect" | "MessageDefinition" | "MessageHeader" | "MolecularSequence" | "NamingSystem" | "NutritionOrder" | "Observation" | "ObservationDefinition" | "OperationDefinition" | "OperationOutcome" | "Organization" | "OrganizationAffiliation" | "Parameters" | "PasswordChangeRequest" | "PaymentNotice" | "PaymentReconciliation" | "Person" | "PlanDefinition" | "PractitionerRole" | "Procedure" | "Project" | "ProjectMembership" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RequestGroup" | "ResearchDefinition" | "ResearchElementDefinition" | "ResearchStudy" | "ResearchSubject" | "RiskAssessment" | "RiskEvidenceSynthesis" | "Schedule" | "SearchParameter" | "ServiceRequest" | "Slot" | "Specimen" | "SpecimenDefinition" | "StructureDefinition" | "StructureMap" | "Subscription" | "Substance" | "SubstanceNucleicAcid" | "SubstancePolymer" | "SubstanceProtein" | "SubstanceReferenceInformation" | "SubstanceSourceMaterial" | "SubstanceSpecification" | "SupplyDelivery" | "SupplyRequest" | "Task" | "TerminologyCapabilities" | "TestReport" | "TestScript" | "User" | "UserConfiguration" | "ValueSet" | "VerificationResult" | "VisionPrescription"-
queryundefined | string | URLSearchParamsThe FHIR search query or structured query object.

Returns

URL

The well-formed FHIR URL.

Defined in

packages/core/src/client.ts:769

Schema

getSchema

getSchema(): IndexedStructureDefinition

Returns a cached schema for a resource type. If the schema is not cached, returns undefined. It is assumed that a client will call requestSchema before using this method.

Deprecated

Use globalSchema instead.

Returns

IndexedStructureDefinition

The schema if immediately available, undefined otherwise.

Defined in

packages/core/src/client.ts:1018


requestSchema

requestSchema(resourceType): Promise<IndexedStructureDefinition>

Requests the schema for a resource type. If the schema is already cached, the promise is resolved immediately.

Parameters

NameTypeDescription
resourceTypestringThe FHIR resource type.

Returns

Promise<IndexedStructureDefinition>

Promise to a schema with the requested resource type.

Defined in

packages/core/src/client.ts:1029

User Profile

getProfile

getProfile(): undefined | ProfileResource

Returns

undefined | ProfileResource

Defined in

packages/core/src/client.ts:1662


getProfileAsync

getProfileAsync(): Promise<undefined | ProfileResource>

Returns

Promise<undefined | ProfileResource>

Defined in

packages/core/src/client.ts:1669


getUserConfiguration

getUserConfiguration(): undefined | UserConfiguration

Returns

undefined | UserConfiguration

Defined in

packages/core/src/client.ts:1679

Other

constructor

new MedplumClient(options?)

Parameters

NameType
options?MedplumClientOptions

Overrides

EventTarget.constructor

Defined in

packages/core/src/client.ts:419


startNewProject

startNewProject(newProjectRequest): Promise<LoginAuthenticationResponse>

Initiates a new project flow.

This requires a partial login from startNewUser or startNewGoogleUser.

Parameters

NameTypeDescription
newProjectRequestNewProjectRequestRegister request including email and password.

Returns

Promise<LoginAuthenticationResponse>

Promise to the authentication response.

Defined in

packages/core/src/client.ts:642


startNewPatient

startNewPatient(newPatientRequest): Promise<LoginAuthenticationResponse>

Initiates a new patient flow.

This requires a partial login from startNewUser or startNewGoogleUser.

Parameters

NameTypeDescription
newPatientRequestNewPatientRequestRegister request including email and password.

Returns

Promise<LoginAuthenticationResponse>

Promise to the authentication response.

Defined in

packages/core/src/client.ts:654


getCodeChallenge

getCodeChallenge(loginRequest): Object

Parameters

NameType
loginRequestLoginRequest | GoogleLoginRequest

Returns

Object

NameType
codeChallenge?string
codeChallengeMethod?string

Defined in

packages/core/src/client.ts:694


startPkce

startPkce(): Promise<void>

Starts a new PKCE flow. These PKCE values are stateful, and must survive redirects and page refreshes.

Returns

Promise<void>

Defined in

packages/core/src/client.ts:1853


processCode

processCode(code): Promise<ProfileResource>

Processes an OAuth authorization code. See: https://openid.net/specs/openid-connect-core-1_0.html#TokenRequest

Parameters

NameTypeDescription
codestringThe authorization code received by URL parameter.

Returns

Promise<ProfileResource>

Defined in

packages/core/src/client.ts:1889


addEventListener

addEventListener(type, callback): void

Parameters

NameType
typestring
callbackEventListener

Returns

void

Inherited from

EventTarget.addEventListener

Defined in

packages/core/src/eventtarget.ts:19


removeEventListeneer

removeEventListeneer(type, callback): void

Parameters

NameType
typestring
callbackEventListener

Returns

void

Inherited from

EventTarget.removeEventListeneer

Defined in

packages/core/src/eventtarget.ts:26


dispatchEvent

dispatchEvent(event): boolean

Parameters

NameType
eventEvent

Returns

boolean

Inherited from

EventTarget.dispatchEvent

Defined in

packages/core/src/eventtarget.ts:39