Creating and Updating Resources

Once you have defined your Data Profiles and Relationship Definitions inside a Data Source, you are ready to start sending data for ingestion.

📘

Clinia used PUT HTTP verb for resource creation and POST for resource upsert with the provided id.

  • PUT allows Clinia system to generate the id property.
  • POST requires an id property to be set and will create the resource if it does not already exist, or update it otherwise (Upsert).

Creating a Resource

To create a resource, you need to specify which source and profile you are targetting, and send the available fields.

{
    "data": {}, // Key-value pair collection of the resource's attributes
    "contained": {}
}

Given the Simple Profile created before, here is an example of a payload that could be sent to create a provider:

{
    "data": {
        "name": "John Doe",
        "practiceNumber": 1020993,
        "specialities": [
            "Pharmacist"
        ]
    }
}

Note: The <resourceId> is sent as a URL paremeter.

Given the Profile with contained resources created before, here is an example of a payload for an office:

{
    "data": {
        "name": "South West Clinic",
        "note": "Offering the best services in Toronto"
    },
    "contained": {
        "primaryPaymentMethod": [
            {
                "id": "office/<rootResourceId>/primaryPaymentMethod/<containedResourceId>",
                "type": "paymentMethod",
                "data": {
                    "value": "Visa"
                }
            }
        ],
        "alternativePaymentMethods": [
            {
                "id": "office/<rootResourceId>/alternativePaymentMethods/<containedResourceId>",
                "type": "paymentMethod",
                "data": {
                    "value": "Mastercard"
                }
            },
            {
                "id": "office/<rootResourceId>/alternativePaymentMethods/<containedResourceId>",
                "type": "paymentMethod",
                "data": {
                    "value": "Amex"
                }
            }
        ]
    }
}

Note: Replace <rootResourceId> with the ID of the resource and <containedResourceId> for every contained resource.

📘

For more Resource endpoint references (Fetch, Delete, Update), see our Resource Creation documentation.

Creating a Relationship

Given the provider - office Relationship Definition, you can link it to an existing office to a provider with the given structure:

{
    "from": {
        "id": "<fromProviderResourceId>",
        "type": "provider"
    },
    "to": {
        "id": "<toOfficeResourceId>",
        "type": "office"
    },
    "data": {} // Optional, if the relationship has some
}

Note: Replace <fromProviderResourceId> with the ID of the provider resource, <toOfficeResourceId> with the ID of the office resource and relationshipResourceId with an ID that identified the given relationship.

Relationship IDs are generated and managed by the system using the following format: <from-resource-type>.<from-resource-id>,<to-resource-type>.<to-resource-id>.

📘

For more Relationship endpoint references (Fetch, Delete, Update), see our Relationship Creation documentation.

🚧

Out of the box, only single resource creation is available. A Bulk API can be configured, depending on client needs and data ingestion volume. Contact [email protected] for more details.