Modifhir Logo
Get Started

Getting Started with Modifhir API

Welcome to the Modifhir API! Learn how to easily transform your data into FHIR-compliant JSON using JSON or plain text inputs.

Note: Please include your API key in the request headers as x-api-key: YOUR_API_KEY.

Base URL

https://api.modifhir.com/api/fhir/[resourceType] (e.g., observation, patient, etc.)

API Endpoint

  • Method: POST
  • Endpoint: /api/fhir/[resourceType] (e.g., observation, patient, etc.)
  • Content-Type: application/json or text/plain
  • Headers: x-api-key: YOUR_API_KEY

JSON Input Example

{
  "resourceType": "Observation",
  "status": "final",
  "code": {
    "coding": [
      {
        "system": "http://loinc.org",
        "code": "718-7",
        "display": "Hemoglobin [Mass/volume] in Blood"
      }
    ]
  },
  "valueQuantity": {
    "value": 13.2,
    "unit": "g/dL"
  }
}

Plain Text Input Example

resourceType: Observation
status: final
code:
  coding:
    - system: http://loinc.org
      code: 718-7
      display: Hemoglobin [Mass/volume] in Blood
valueQuantity:
  value: 13.2
  unit: g/dL

Example cURL Command

curl -X POST https://api.modifhir.com/api/fhir/observation \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "resourceType": "Observation",
    "status": "final",
    "code": {
      "coding": [
        {
          "system": "http://loinc.org",
          "code": "718-7",
          "display": "Hemoglobin [Mass/volume] in Blood"
        }
      ]
    },
    "valueQuantity": {
      "value": 13.2,
      "unit": "g/dL"
    }
  }'

JavaScript (Node.js) Example

const fetch = require('node-fetch');

const data = {
  "status": "final",
  "code": {
    "coding": [
      {
        "system": "http://loinc.org",
        "code": "718-7",
        "display": "Hemoglobin [Mass/volume] in Blood"
      }
    ]
  },
  "valueQuantity": {
    "value": 13.2,
    "unit": "g/dL"
  }
};

fetch('https://api.modifhir.com/api/fhir/observation', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY',
  },
  body: JSON.stringify(data),
})
  .then(response => response.json())
  .then(responseData => {
    console.log('FHIR-compliant JSON:', responseData);
  })
  .catch(error => {
    console.error('Error:', error);
  });

Python Example

import requests

url = 'https://api.modifhir.com/api/fhir/observation'
headers = {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY',
}

data = {
    "status": "final",
    "code": {
        "coding": [
            {
                "system": "http://loinc.org",
                "code": "718-7",
                "display": "Hemoglobin [Mass/volume] in Blood"
            }
        ]
    },
    "valueQuantity": {
        "value": 13.2,
        "unit": "g/dL"
    }
}

response = requests.post(url, headers=headers, json=data)
print('FHIR-compliant JSON:', response.json())

C# Example

using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        var client = new HttpClient();

        var data = @"{
            ""status"": ""final"",
            ""code"": {
                ""coding"": [
                    {
                        ""system"": ""http://loinc.org"",
                        ""code"": ""718-7"",
                        ""display"": ""Hemoglobin [Mass/volume] in Blood""
                    }
                ]
            },
            ""valueQuantity"": {
                ""value"": 13.2,
                ""unit"": ""g/dL""
            }
        }";

        var request = new HttpRequestMessage(HttpMethod.Post, "https://api.modifhir.com/api/fhir/observation");
        request.Headers.Add("x-api-key", "YOUR_API_KEY");
        request.Content = new StringContent(data, Encoding.UTF8, "application/json");

        var response = await client.SendAsync(request);
        var responseBody = await response.Content.ReadAsStringAsync();
        Console.WriteLine("FHIR-compliant JSON: " + responseBody);
    }
}
We are currently growing our team. Join us!