1

I am trying to access PokitDok's eligibility API, which wants the following:

client.eligibility({
    member: {
        birth_date: "1970-01-25",
        first_name: "Jane",
        last_name: "Doe",
        id: "W000000000"
    },
    provider: {
        first_name: "JEROME",
        last_name: "AYA-AY",
        npi: "1467560003"
    },
    trading_partner_id: "MOCKPAYER"
})

The ColdFusion I have written is the following:

<cfset SubmissionFields = {
    "member": {
       birth_date: "1970-01-25",
        "first_name": "Jane",
        "last_name": "Doe",
        "id": "W000000000"
    },
    "provider": {
        "first_name": "JEROME",
        "last_name": "AYA-AY",
        "npi": "1467560003"
    },
    "trading_partner_id": "MOCKPAYER"
} />


<cfhttp url="https://platform.pokitdok.com/oauth2/token/eligibility/" username="xxxx" password="xxxx" method="post" result="httpResponse" timeout="60">
    <cfhttpparam type="header" name="Content-Type" value="application/json" />
    <cfhttpparam type="body" value="#serializeJSON(SubmissionFields)#">
</cfhttp>

Where do I put the client.eligibility function call (if that is what it is)?

Thanks!

Leigh
  • 28,765
  • 10
  • 55
  • 103
user2485860
  • 21
  • 1
  • 1
  • 3
  • What exactly is the first snippet? javascript? because... that javascript isn't going to help you make this request. You need to know what that javascript library is doing behind the scenes to make said request. – Kevin B May 04 '17 at 16:00
  • The first snippet is the sample code from the PokitDok documentation. This is the JSON they seem to want. There is a separate place where they list the API URL, username, etc. – user2485860 May 04 '17 at 17:52
  • 1
    in that case, *"Where do I put the client.eligibility function call (if that is what it is)"* client.eligibility is irrelevant. the only problem i see is not having quotes around birth_date. It's valid to not have quotes, but without them, using default settings, serializeJSON will capitalize it. – Kevin B May 04 '17 at 18:07
  • Since you are using cfhttp, I assume you are trying to emulate the curl example on that page? – Leigh May 04 '17 at 18:22
  • Yes, I am. Apologies for not including quotes; yes, birth_date should have quotes. Let me try without any reference to client.eligibility – user2485860 May 04 '17 at 19:49
  • @user2485860 - You can use "@" + username to notify the person you are responding to. (Unfortunately S.O. stops notifying automatically once two (2) or more people post comments). – Leigh May 04 '17 at 20:06

1 Answers1

2

PokitDok has an open source Java client, which could be integrated into your Coldfusion project since it runs in the JVM. Here is their Java client:

https://github.com/pokitdok/pokitdok-java

Here are two other StackOverflow posts that address how to integrate existing Java Libraries into your Coldfusion project:

1) How do you use java files in Coldfusion

2) Include Java Files into Coldfusion

(affiliation edit: I am pokitdok's tech evangelist)

Community
  • 1
  • 1
  • Yes, a java library should work (and may be simpler with complex libs). Though isn't it just a matter of making an http call and submitting JSON? Seems like it should work with their existing code, assuming the correct headers and authentication (whatever the API requires, basic authentication, oauth, etcetera). – Leigh May 04 '17 at 21:16
  • (BTW, responses from folks knowledgeable about the tool in question are always welcome, but please be sure to disclose affiliation with any links posted per the [site guidelines](http://stackoverflow.com/help/behavior).) – Leigh May 04 '17 at 22:16
  • 1
    thanks for helping me out with the site guidelines; I am pokitdok's tech evangelist. and yes -- it is just as simple as hitting a restful API with json. we do require oauth2, so if the user here wants to skip the code for authenticating with our platform, I would recommend using our open source api clients: https://github.com/pokitdok – Denise Gosnell May 05 '17 at 19:46
  • Ah, that makes sense. Good to know the API clients simplify things by handling that for you behind the scenes. – Leigh May 05 '17 at 20:22