Sample HIU - NHA-ABDM/ABDM-wrapper GitHub Wiki

This is a sample SpringBoot application which demonstrates how to invoke wrapper APIs and which API to expose which wrapper can invoke.

You can register your HIU in the same way you register an HIP which is by running the following command:

curl --location --request PUT '' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
--data '[
        "id": "Demo_HIU",
        "name": "Demo HIU",
        "type": "HIU",
        "active": true,
        "alias": [

Here are the APIs exposed by wrapper which an HIU application needs to call:

  • For consent:
    • consent-init
    • consent-status/{requestId}
  • For data transfer:
    • health-information/fetch-records
    • health-information/status/{requestId}

Here are the APIs which an HIP should expose:

  • For data transfer:
    • health-information

To call the apis exposed by wrapper, we can use openApiGenerator which can generate language of your choice and then you can create request bodies and pass on to the generated functions. This Sample HIU application contains Java generated code in generated folder and demonstrates how to create requests and pass on to generated api functions which in turn will call wrapper api. demonstrates how to implement and expose /health-information

Steps to generate code of your choice:

  • Provide your language here: openApiGenerate function: generatorName.set("your language")
  • At terminal, go to sample-hiu cd sample-hiu
  • Run gradle openApiGenerate

How to bring Sample HIU application up:

  • At terminal, go to sample-hiu cd sample-hiu
  • Run gradle bootRun

How to test sample HIU's APIs

Go to or create a similar "Controller" file in your preferred language

  • consent-init:
    • Make changes to initiateConsent method for consent details or create a similar new method in your controller.
    • By this time, it is assumed that wrapper application is running. Now bring sample HIU application up.
    • Open Postman and post a request to http://localhost:8083/v1/test-wrapper/consent-init Grant this consent using PHR app.
  • consent-status/{requestId}:
    • Get hold of the request ID which you used to send consent init request: initConsentRequest.setRequestId(requestId);
    • Use that requestId in consentStatus method: consentApi.consentStatusRequestIdGet(requestId)
    • Restart sample-hiu.
    • Open postman and post a request to http://localhost:8083/v1/test-wrapper/consent-status At this point it is assumed that consent has been granted.
  • health-information/fetch-records:
    • Make changes to healthInformation method to create health information request using the consent id which was granted earlier. You would get this consent id as response of consent-status call.
    • Restart sample-hiu.
    • Open postman and post a request to http://localhost:8083/v1/test-wrapper/health-information
  • health-information/status/{requestId}:
    • Get hold of the request id which you used to send consent init request: hiuClientHealthInformationRequest.setRequestId(healthInformationRequestId);;
    • Use that requestId in healthInformationStatus method: return dataTransferApi.healthInformationStatusRequestIdGet(healthInformationRequestId);
    • Open postman and post a request to http://localhost:8083/v1/test-wrapper/health-information-status