Vince
asked on
Using MS ACCESS and VBA to create REST/JSON file.
I have been programming in VBA/ACCESS for quite a few yrs but new to JSON and REST. I am not able to get to the web-site <https://code.google.com/p/vba-json/> to see the code you are referring to. Would it be possible to see a sample of your ACCESS Database to understand how to grab the REST data, using JSON? Thank you very much!!
ASKER
I need help w/ retrieving and parsing. Here is the URL:
https://help.sp.ca.sandia.gov/helpdesk/WebObjects/Helpdesk.woa/ra/Assets?style=all&apiKey=p3Jd1NGWkVNKagEyEu0EWK76sDfxXd39SKeDFlPu
Thank you
https://help.sp.ca.sandia.gov/helpdesk/WebObjects/Helpdesk.woa/ra/Assets?style=all&apiKey=p3Jd1NGWkVNKagEyEu0EWK76sDfxXd39SKeDFlPu
Thank you
I'm getting a webpage not available message
ASKER
Attached, is a file of the output when I put the URL in a Firefox Browser:
The-REST-Output.txt
The-REST-Output.txt
What do you need to get out of those JSON objects?
ASKER
I have never done any web/JSON/REST work w/ MS-ACCESS I am trying to figure out how to do the following:
1. submit a url string using VBA in MS-ACCESS,
2. Retrieve the output from the call that so I can parse the data and do w/ it what I want.
3. How to submit a url string so I can update one of the Parameters for instance in the example below I would like to update the "networkName" value and the "purchaseDate value:
{
"id": 1,
"type": "Asset",
"assetNumber": "1",
"contractExpiration": "2014-09-30T07:00:00Z",
"macAddress": null,
"networkAddress": null,
"networkName": null,
"notes": null,
"purchaseDate": "2013-12-30T08:00:00Z",
"serialNumber": null,
"version": "2010",
"assetstatus": {
"id": 2,
"type": "AssetStatus"
},
1. submit a url string using VBA in MS-ACCESS,
2. Retrieve the output from the call that so I can parse the data and do w/ it what I want.
3. How to submit a url string so I can update one of the Parameters for instance in the example below I would like to update the "networkName" value and the "purchaseDate value:
{
"id": 1,
"type": "Asset",
"assetNumber": "1",
"contractExpiration": "2014-09-30T07:00:00Z",
"macAddress": null,
"networkAddress": null,
"networkName": null,
"notes": null,
"purchaseDate": "2013-12-30T08:00:00Z",
"serialNumber": null,
"version": "2010",
"assetstatus": {
"id": 2,
"type": "AssetStatus"
},
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am going to need all the fields parsed
ASKER
What References do I need to set?
REST is nothing more than an architectural style for doing a web site. JSON I believe is just a method of formatting the strings based on some stuff in Java, but in VBA it all boils down to POST and GET. I think for the JSON part, you could setup a JSON parser based on it's principles, but I'm not sure you'd need to go that far. Split works pretty well if your needs are no extensive.
And while that routine I posted looks lengthy, most of it is just setting up the string to pass. The actual back and forth with the web site is only the couple of lines as Mark showed and which you'll see in the middle of the routine I posted.
Jim.
And while that routine I posted looks lengthy, most of it is just setting up the string to pass. The actual back and forth with the web site is only the couple of lines as Mark showed and which you'll see in the middle of the routine I posted.
Jim.
ASKER
So if I am understanding this correctly. I get the data by first building the strPostString.
Then sending the strPostString w/ the objRequest.Open and the objRequest.Send strPostString
Then, I capture the returned data with the strPostResponse = objRequest.responseText
I then parse out the returned data captured in the strPostResponse variable.
Is my thinking correct?
Dim objRequest As New MSXML2.XMLHTTP
objRequest.Open "POST", strPostURL, False
objRequest.Send strPostSting
strPostResponse = objRequest.responseText
Then sending the strPostString w/ the objRequest.Open and the objRequest.Send strPostString
Then, I capture the returned data with the strPostResponse = objRequest.responseText
I then parse out the returned data captured in the strPostResponse variable.
Is my thinking correct?
Dim objRequest As New MSXML2.XMLHTTP
objRequest.Open "POST", strPostURL, False
objRequest.Send strPostSting
strPostResponse = objRequest.responseText
yes. That is the basic scheme.
Pushing updates is going to be a bit different.
Pushing updates is going to be a bit different.
btw...I don't think that VBA-JSON project is complete.
ASKER
I was able to get the returned data using the above examples, then, parse the data as needed. Now I need to understand how to update a record.
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
What is the URL from which you are retrieving the data?