Vba api

valglad

New Member
Joined
Dec 19, 2012
Messages
6
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;">
I don't know much about API, in fact, almost nothing. I used Google POSTMAN to make a POST request to extract some data from Adaptive Insights. What I would like to do is execute the call from Excel VBA and update an Excel sheet when I need by pressing a button.
Here is the snippet from POSTMAN:

<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;"> POST /api/v13 HTTP/1.1
Host
: api.adaptiveinsights.com
Authorization
: Basic ZmlubWdyX3NhbGVzQHN0ZW1jZWxsLmNvbTpBZGFwdGl2ZTE=
Content
-Type: application/xml
cache
-Control: no -cache
Postman
-Token:650bd3ad-82e9-aa33-ae77-ee4d89ff0fd8

<!--?</font-->xml version='1.0' encoding='UTF-8'?>
<call method="exportData" callerName="Export.xlsx">
<credentials login="******@****.com" password="*****"/>
<version name="FY2017-November V2" isDefault="false"/>
<format useInternalCodes="true" includeUnmappedItems="false"/>
<filters>
<timeSpan start="Jan-2017"end="Feb-2017"/><!--</font-->filters>
<rules includeZeroRows="false" includeRollups="true" markInvalidValues="false" markBlanks="false"
timeRollups
="single">
<!--</font-->rules>
<!--</font-->call>


</code>
Here is the output from POSTMAN

<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;"><!--?</font-->xml version="1.0" encoding="UTF-8"?>
<response success="true">
<output><!--[</font-->CDATA[Account Name,Account Code,Level Name,Rollup
.......................................................

</code>
I did a fair bit of googling and this is what I have so far for my macro:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;"> myURL ="https://api.adaptiveinsights.com/api/v13"
xmlHTTP
.Open "POST", myURL,False
xmlHTTP
.SetCredentials "****@****.com","*****", HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
xmlHTTP
.SetRequestHeader "Content-Type","application/xml"
xmlHTTP
.Send

Set xmlResult =New MSXML2.DOMDocument

xmlResult
.LoadXML xmlHTTP.ResponseText



</code>What I'm struggling is how to extract that specific set of data - "FY2017-November V2" for timeSpan start ="Jan-2017" end="Feb-2017". How do I load the data into Excel, in essence, do in VBA what I did in POSTMAN?


Would really appreciate any help.




Thank you


Valglad

<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;">

</code>
</code>
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,216,419
Messages
6,130,515
Members
449,585
Latest member
kennysmith1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top