API Hacking: Sketchfab Uploader for Mac

Back to overview

In the API Hacking series, we’re exploring new ways to use Sketchfab through use of our API.

image

Our lead designer Maurice created a desktop application that will let you drag-and-drop files into your Sketchfab account. Download the app and learn how he did it!

Design is often about prototyping and trying new things. Every week, we try to build something new in an afternoon. The Sketchfab Uploader is one of these experiments.

It’s a desktop app (Mac only for now) that allows you to upload models in bulk by drag’n’dropping files from your computer into the app.

What’s inside

To build this app, we used NW.js (formerly node-webkit), a runtime that makes it easy to create desktop apps with JavaScript, HTML and CSS. It’s basically a browser and Node.js combined into one single app. It’s a great way to prototype quickly as you can reuse web development skills and the workflow looks a lot like developing a website. Another benefit is that the app could be packaged for Windows or Linux very easily.

If you are interested in NW.js, this wiki has a few tutorials to get you started.

How it works

Uploading a model to Sketchfab via the Data API is fairly easy. All you need to do is send a Multipart POST request to https://api.sketchfab.com/v2/models with the right parameters and the file attached. Of course, this request must be signed with your API token, which can be found in the Password settings of your account. The API also provides an endpoint to check when the model is finished processing.

To help you, the API documentation offers code samples for many languages including Python, PHP, Objective C and more.

In our case, things were even simpler as we used the ready-to-use node-sketchfab library. All we had to do is type npm install node-sketchfab to get ready-to-use functions for uploading models to Sketchfab. You can check out this file to see how we use the library.

If you are want to learn more about how we built the app, the full source code for the desktop uploader is available at https://github.com/sketchfab/sketchfab-uploader.

If you need support for your API project, please visit our Development and API forum.

– Maurice

image

About the author

Sketchfab Team



No Comments

    Related articles