Call web services from a Fusion add-in

There are more and more web services available out there on the net and integration with those can bring real value to your product. Sometimes the web service in itself is the real value provided by the add-in in which case you do not really need to protect the IP of your add-in and might as well use open JavaScript or Python instead of a compiled C++ project.

The following sample script is written in Python and it simply lists all the repositories inside our Fusion 360 GitHub account: https://github.com/AutodeskFusion360

When the user selects a repository from the drop-down combo box then the description field will get updated inside the command dialog. If the user clicks OK then the browser will jump to the URL of the selected repository.

HttpSample

 

It's fairly easy to implement such a thing in Python. I could use the http.client library for the HTTP communication, json library to turn the JSON response strings into arrays and dictionaries which make it much easier to get the data out of them, and the webbrowser library to start the default web browser on the system and show a given URL.

You can find the source code here: https://github.com/AutodeskFusion360/HttpSample

-Adam


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading