VBA-Web library for using REST APIs

Started by Visisthebest, May 12, 2020, 11:07:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Visisthebest

I saw this VBA library for accessing REST APIs and processing JSON on GitHub:
https://github.com/VBA-tools/VBA-Web

does anyone have any (hopefully) positive experiences with using this library in Visio VBA?

From what I can see it is actively updated.
Visio 2021 Professional

Nikolay

#1
With almost 1500 stars on GitHub, I would be pretty sure it works :D

Visio VBA is not much different from any other VBA.

I would never do any web-calls with VBA though.
VBA is single-threaded by design, your user interface will be frozen until the request finishes.

Visisthebest

Nikolay yes good point that could really undermine the user experience.
Visio 2021 Professional

vojo

I would imagine he wants to get/set shape shape data

Otherwise, I would proffer that using a REST context to draw shapes (geometries et al) would be the
perfect example of Rube Goldberg solution to a problem
("why crack a walnut with a nut cracker when you have a thermonuclear device at hand).

Note that even within visio, it takes a lot of skill to play with geometries especially if formulas involved.
Look at visio guy's constraining control handles on a circle and imagine if you used a REST context to define that.

Visisthebest

#4
It is only for getting some shape-specific data (data read from a REST API service are linked to specific shapes in a diagram linked via a unique identifier) that does not influence the shape visually other than showing some additional info in the text box or an extra text label, no writing data back via REST.

I assume it is possible to show a progress dialog window with a cancel button for the user to abort importing data from a REST API if it takes too long, it is a read-only scenario so much simpler than doing updates and having to verify if updates were done completely and correctly.
Visio 2021 Professional

Nikolay

Quote from: Visisthebest on May 13, 2020, 09:38:28 AM
It is only for getting some shape-specific data (data read from a REST API service are linked to specific shapes in a diagram linked via a unique identifier) that does not influence the shape visually other than showing some additional info in the text box or an extra text label, no writing data back via REST.

I assume it is possible to show a progress dialog window with a cancel button for the user to abort importing data from a REST API if it takes too long, it is a read-only scenario so much simpler than doing updates and having to verify if updates were done completely and correctly.

It is not possible to do that (the progress dialog with cancel button). This is what "single - threaded" means, if translated to user language :D

Nikolay

BTW, regarding the REST, I would try to use the built-in Visio "Connect to Data" maybe?
There are some "connectors" out there you could use to "convert" a REST API into a standard ODBC "database-like" data source that can be consumed by the Visio.

Here is one for example:
https://www.cdata.com/kb/tech/rest-odbc-visio.rst

Here is another:
https://www.progress.com/tutorials/odbc/query-any-rest-api-using-odbc-in-5-mins---getting-started-(part-1)

No code. All built-in.

Visisthebest

Thank you Nikolay I didn't know this solution existed will check it out!
Visio 2021 Professional