API v2 Answering Service API

API v2 Answering Service API

Please contact [email protected] to get your credentials and encryption key and correct urls for your account.

Environment Connections

DEVELOPMENT or Sandbox (Unstable) - Test data

QA (Stable) - Live data

      $server_url: https://mtc-qa.my247healthcare.com/cc/modules/apiv2


PRODUCTION - Live data


Token Create Post Parameters:

      "login_username":"{API USERNAME}"
      "login_password":"{ENCRYPTED PASSWORD}"

Post URLs

Token Create Post URL: $server_url/index.php?resource=tokenCreate

Ticket Submission Post URL: $server_url/index.php?resource=adi&token=FuGBtOni95Bw0fNo

Ticket Status URL: $server_url/index.php?resource=ticketStatus&token=FuGBtOni95Bw0fNo&ticket_id=RQxQ5s84H





Client Overview

1. Token Create

We are using a token based API. For this you have to create a token and send this token when calling the API. This token will be validated up to two hours from the user's last activity. To create a token, you have to call the Token Create API with a username and encrypted password. For Encryption & Decryption of the password we are using openssl_encrypt & openssl_decrypt method, where a key is required, this key value is only known Sender to Receiver.




API Name

Token Create

API Desc

Please send encrypted password, not plain login password

URL

$server_url/index.php?resource=tokenCreate

Method

POST

Parameter

{

"login_username"*:"{API USERNAME}",

"login_password"*:"{ENCRYPTED PASSWORD}"

}

Return

{

    "success":true,

    "result":

    {

        "token":"FuGBtOni95Bw0fNo"    

    },

    "errors":[]

}




2. Ticket Submission/Answering Service

To create a new ticket you must send the token in the POST.


API Name

Answering Service (Create Ticket)

API Desc

Create a new ticket

URL

$server_url/index.php?resource=as&token=FuGBtOni95Bw0fNo

Method

POST

Parameter

{

"patient_lname"*:"example fname",

"patient_fname"*:"example lname",

"dob"*:"19891230",

“complaint"*:"issue",

“prac”*:”1234”

“client_code”*:""

"contact_phone":"1234567890",

"contact_phone_2":"1234567890",

"sex":"male",

"email":"[email protected]",

"address":"address",

"city":"city",

"state":"FL",

"zip":"90210",

"caller_lname":"example lname",

"caller_fname":"example fname",

"relationship":"relationship to patient",

"comments":"comments for nurse",

"txt":"1|2|3|4",

"Call_type":"1",

"field_mr":"123|ABC123",

}

Return

{

    "success":true,

    "result":

    {

        "field_mr":"123|123",

        "call_type":"1",

        "patient_lname":"example fname",

        "patient_fname":"example lname",

        "dob":"19891230",

        "sex":"male",

        "complaint":"issue",

        "caller_lname":"example lname",

        "caller_fname":"example fname",

        "relationship":"relationship",

        "contact_phone":"1234567890",

        "contact_phone_2":"1234567890",

        "email":"[email protected]",

        "address":"address",

        "city":"city",

        "state":"FL",

        "zip":"90210",

        "ticket_id":"xxxxxxxx",

        "notes":"2020-10-01 13:19:10 : Created by Answering Service API v2.0 from $company by $user"

    },

    "errors":[]

}



3. Ticket Status

A ticket status can retrieved using the Token and TicketID


API Name

Ticket Status

API Desc

Checking ticket status

URL

$server_url/index.php?resource=ticketStatus&token=FuGBtOni95Bw0fNo&ticket_id=RQxQ5s84H

Method

GET

Parameter

Return

{

  "success": true,

  "result": {

    "ticket_id": "Y27szqASe",

    "ticket_status": "IN PROGRESS"

  },

  "errors": [


  ]

}



Developer Notes

Password Encryption Decryption Tool (or do this on your server code below.)

Encrypted with using openssl_encrypt, openssl_decrypt and base64_encode, base64_decode php function.

CipherMethod = “aes-256-cbc”

EncryptionDecryptionKey= “{hidden key}”

https://dev.my247healthcare.com/encrypt.php?p=password&c=cypher&k=key

&c and &k not needed if using the following defaults. 


Example of creating your own password encryption function in PHP.

public static function EncryptionCustom($Str='')

{

    if(isset($Str) && trim($Str)!='' )

    {

    $CipherMethod=CosmicConfiguration::CipherMethod;

    $EncryptionDecryptionKey=CosmicConfiguration::EncryptionDecryptionKey;


    $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($CipherMethod));

    $encrypted = openssl_encrypt($Str, $CipherMethod, $EncryptionDecryptionKey, 0, $iv);

     

    $data= base64_encode($encrypted . '::' . $iv);

    return $data;


    }

    else

    {

      return '';

    }

}


public static function DecryptionCustom($Str='')

{

    if(isset($Str) && trim($Str)!='' )

    {

    $CipherMethod=CosmicConfiguration::CipherMethod;

    $EncryptionDecryptionKey=CosmicConfiguration::EncryptionDecryptionKey;


    list($encrypted_data, $iv) = explode('::', base64_decode($Str), 2);

    if(isset($encrypted_data) && $encrypted_data!='' && isset($iv) && $iv!='')

    {

    $data= openssl_decrypt($encrypted_data, $CipherMethod, $EncryptionDecryptionKey, 0, $iv);

    return $data;

    }

    else

    {

    return '';

    }

     

    }

    else

    {

    return '';

    }

}



Please check back to this document as we add additional details each week.


ERROR CODES

406 = Invalid Ticket when requesting ticket status.
406 = Invalid doctor code when submitting a ticket.
407 = Missing required information.
408 = Not authenticated. Token has expired or user not found.
413 = Missing required information on Ticket request or unable to create token.
414 = Doctor submitted does not exist in submitted practice.