I found some code, hacked it up managed to retrieve a JSON object from a particular site but I can't seem to manage wrapping my mind around what the objects/members are for retrieving data... There is an attribute in basicinfo that I would like (as well as one more if I can find it) but in looking at the watch and the returned hierarchy, I never could manage to figure out how to retrieve anything. This one stumps me. I never did like playing with Java Script... I can see this one right, I can probably figure others out. Ironically the sample I swiped this from does not seem to work entirely and does not show its object hierarchy in watch window.
Am I missing a function that retrieves attributes or am I just too dense to get the syntax right? In any case please show me the way.
Am I missing a function that retrieves attributes or am I just too dense to get the syntax right? In any case please show me the way.
Code:
Sub ReadNPIData(strNPI)
'To find a a sample NPI goto:
' [URL unfurl="true"]https://npiregistry.cms.hhs.gov/[/URL]
' Enter information like first and last name and state of your doctor
' Hit search
Dim NPIRequest As Object
Dim scriptControl As Object
Dim JsonObject As Object
Set scriptControl = CreateObject("MSScriptControl.ScriptControl")
scriptControl.Language = "JScript"
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", "[URL unfurl="true"]https://npiregistry.cms.hhs.gov/api/?number="[/URL] & strNPI & "&enumeration_type=&taxonomy_description=&first_name=&last_name=&organization_name=&address_purpose=&city=&state=&postal_code=&country_code=&limit=&skip=", False
.Send
Set NPIRequest = scriptControl.Eval("(" + .responsetext + ")")
.abort
Stop 'Put Watch on NPIRequest you can view elements... Syntax is eluding me for retrieving elements
'Clearly it can return a hierarchy
Debug.Print NPIRequest.Items(1).Number 'just one of several failures I tried this one exudes my frustration
End With
End Sub