Hi,
How can access the Rest API Login endpoint using VBA code? Do you have a simple sample codes for this kind of access?
Thank you very much.
Regards,
Mok Kiew
How to access Rest API Login Endpoint using VBA
Hi,
How can access the Rest API Login endpoint using VBA code? Do you have a simple sample codes for this kind of access?
Thank you very much.
Regards,
Mok Kiew
Hi Mok Kiew,
I've never written any VBA and very little VB personally, but I think this stackoverflow thread does some general API type stuff, and it does contain some information about setting headers: http://stackoverflow.com/questions/19553476/how-to-make-rest-call-with-vba-in-excel
You'll want to do a GET to /rest/v1/login/admin
or another user with the password in a header named "password" which will get you a response with a Set-Cookie header if successful. You'll have to pass that header's value as the "Cookie" header in subsequent requests.
You may need to include the XSRF-TOKEN portion of the Cookie under the X-Xsrf-Token header, as well. If this is required you'll have a 403 Forbidden response when using just the Cookie header.
Someone else may chime in with an example script. Good luck!
Hi,
To add to what phildunlap said, you must include 'application/json' in the accepts header.
If basing your code on the question and answers on that stackoverflow page, you would need to add the following line before invoking the send method:
objHTTP.setRequestHeader "accept", "application/json"
Regards,
Gary