Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Customers need to provide the form ID(s) that they want to add attachments to using this API.

  • Provide these form IDs to Service or Engineering so that they can enable attachments via the API on the backend.in Form Builder. Required for CRM & EMR Forms.

    • image-20250421-145111.pngImage Added

Sunwave API for

...

attaching forms

Syntax

POST https://emr.sunwavehealth.com/SunwaveEMR/api/addforminpatientchart
Content-Type: application/json
Authorization: Digest $token
seed = user_id:client_id:dateTimeBase64:clinic_id:unique_transaction_id:Base64Encode(md5Hex(payload))
token = seed:JWT.hmac(seed, privateKey)

Note: the endpoint URL must be lowercase

Parameters

  • user_id: Service User account created for use in ERP Health integration:
    Example: john.doe@acmehealth.com

  • client_id: This is the Realm Client Id which will be provided by Engineering upon enabling ERP Health integration. (Practice Setup > External Apps)

  • privateKey: This is the Realm Private Key which will be provided by Engineering upon enabling ERP Health integration. (Practice Setup > External Apps)

  • clinic_id: This is the Realm ID, for example ‘236’ for the Training Realm.

  • unique_transaction_id: Each call to the Sunwave API must have a unique transaction id. See the section below called Generating unique_transaction_id for more information. See Generating unique_transaction_id for more information.

  • dateTimeBase64: Base64 encoded of the GMT DateTime string formatted as "EEE, d MMM yyyy HH:mm:ss Z"
    Example: Thu, 8 Sep 2022 19:34:06 +0000

    • Example code for generating dateTimeBase64:
      Java
      SimpleDateFormat df = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z");
              df.setTimeZone(TimeZone.getTimeZone("GMT"));
              Timestamp now = new Timestamp(new java.util.Date().getTime());
              String dateTime = df.format(now);
      String dateTimeBase64 = new String(Base64.getEncoder().encode(dateTime.getBytes()));

      Apex
      DateTime dt = System.now();
              String formatedDate = dt.formatGMT('EEE, d MMM yyyy HH:mm:ss Z');
              String formatedDateBase64 = EncodingUtil.base64Encode(Blob.valueof(formatedDate))

...

{
"account_id": "string",
"service_date":"string",
"patient_first_name": "string",
"patient_last_name": "string",
"patient_dob": "string",
"form_id": "string",
"pdf_payload": "<base64-pdf>"
}

  • Service Date must be after a patient admission date. If Service Date pre-dates admission date no post will occur.

  • Forms may be posted to discharged clients

Info

NOTE: Please limit the size of PDF attachments to 200KB or smaller.

...

{
"account_id": "133038",
"service_date":"2022-05-11",
"patient_first_name": "Arnold",
"patient_last_name": "Sullivan",
"patient_dob": "1999-01-01",
"form_id": "236",
"pdf_payload": "data:application/pdf;base64,JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVHlwZSAvQ2F0YWxvZwogIC9QYWdlcyAyIDAgUgo+PgplbmRvYmoKCjIgMCBvYmoKPDwKICAvVHlwZSAvUGFnZXMKICAvTWVkaWFCb3ggWyAwIDAgMjAwIDIwMCBdCiAgL0NvdW50IDEKICAvS2lkcyBbIDMgMCBSIF0KPj4KZW5kb2JqCgozIDAgb2JqCjw8CiAgL1R5cGUgL1BhZ2UKICAvUGFyZW50IDIgMCBSCiAgL1Jlc291cmNlcyA8PAogICAgL0ZvbnQgPDwKICAgICAgL0YxIDQgMCBSIAogICAgPj4KICA+PgogIC9Db250ZW50cyA1IDAgUgo+PgplbmRvYmoKCjQgMCBvYmoKPDwKICAvVHlwZSAvRm9udAogIC9TdWJ0eXBlIC9UeXBlMQogIC9CYXNlRm9udCAvVGltZXMtUm9tYW4KPj4KZW5kb2JqCgo1IDAgb2JqICAlIHBhZ2UgY29udGVudAo8PAogIC9MZW5ndGggNDQKPj4Kc3RyZWFtCkJUCjcwIDUwIFRECi9GMSAxMiBUZgooSGVsbG8sIHdvcmxkISkgVGoKRVQKZW5kc3RyZWFtCmVuZG9iagoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDEwIDAwMDAwIG4gCjAwMDAwMDAwNzkgMDAwMDAgbiAKMDAwMDAwMDE3MyAwMDAwMCBuIAowMDAwMDAwMzAxIDAwMDAwIG4gCjAwMDAwMDAzODAgMDAwMDAgbiAKdHJhaWxlcgo8PAogIC9TaXplIDYKICAvUm9vdCAxIDAgUgo+PgpzdGFydHhyZWYKNDkyCiUlRU9G"
}

Postman Project

View file
nameAPI - Attatch PDF to Form.json

Anchor
generate_unique_id
generate_unique_id
Generating unique_transaction_id

...