# UpsertMedicalResourceRequest

Artifact: [androidx.health.connect:connect-client](https://developer.android.com/jetpack/androidx/releases/health-connect) [View Source](https://cs.android.com/search?q=file:androidx/health/connect/client/request/UpsertMedicalResourceRequest.kt+class:androidx.health.connect.client.request.UpsertMedicalResourceRequest) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

*** ** * ** ***

<br />

```
@ExperimentalPersonalHealthRecordApi
class UpsertMedicalResourceRequest
```

<br />

*** ** * ** ***

A request class for both inserting and updating `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource`s.

From `https://developer.android.com/reference/kotlin/androidx/health/connect/client/request/UpsertMedicalResourceRequest#dataSourceId()`, fhir resource type and fhir resource ID extracted from `https://developer.android.com/reference/kotlin/androidx/health/connect/client/request/UpsertMedicalResourceRequest#data()`, a `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResourceId` will be constructed. If there already exists a `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource` with that `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResourceId` in Health Connect, then that `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource` will be updated, otherwise a new `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource` will be inserted.

The data representation follows the [Fast Healthcare Interoperability Resources (FHIR)](https://hl7.org/fhir/) standard.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/kotlin/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/kotlin/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD()` as an argument.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/request/UpsertMedicalResourceRequest#UpsertMedicalResourceRequest(kotlin.String,androidx.health.connect.client.records.FhirVersion,kotlin.String)( dataSourceId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, fhirVersion: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirVersion, data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html )` |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/request/UpsertMedicalResourceRequest#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/request/UpsertMedicalResourceRequest#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/request/UpsertMedicalResourceRequest#toString()()` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/request/UpsertMedicalResourceRequest#data()` The FHIR resource data in JSON representation. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/request/UpsertMedicalResourceRequest#dataSourceId()` The ID of an **existing** `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalDataSource` where the data being inserted comes from. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirVersion` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/request/UpsertMedicalResourceRequest#fhirVersion()` The FHIR version being used for `https://developer.android.com/reference/kotlin/androidx/health/connect/client/request/UpsertMedicalResourceRequest#data()`. |

## Public constructors

### UpsertMedicalResourceRequest

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
UpsertMedicalResourceRequest(
    dataSourceId: String,
    fhirVersion: FhirVersion,
    data: String
)
```

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

```
open fun hashCode(): Int
```

### toString

```
open fun toString(): String
```

## Public properties

### data

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
val data: String
```

The FHIR resource data in JSON representation.

### dataSourceId

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
val dataSourceId: String
```

The ID of an **existing** `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalDataSource` where the data being inserted comes from.

### fhirVersion

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
val fhirVersion: FhirVersion
```

The FHIR version being used for `https://developer.android.com/reference/kotlin/androidx/health/connect/client/request/UpsertMedicalResourceRequest#data()`. This must match `https://developer.android.com/reference/kotlin/androidx/health/connect/client/request/UpsertMedicalResourceRequest#dataSourceId()`'s `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalDataSource#fhirVersion()`.