Note: For using this sample, you need a valid oAuth credential. Visit this page for instructions to get on-board.
Demonstrates the Autodesk Forge API authorisation and translation process using cURL in command line scripts.
This sample exercises the cURL command demonstrating the Forge OAuth authorisation and Model Derivatives API mentioned in the Quick Start guide.
In order to make use of this sample, you need to register your consumer key, of course:
This provides the credentials to supply while calling the Forge WEB service API endpoints.
Standard OS functionality, Bash, cURL and JQ.
This sample targets Mac OSX and Unix only, it should run on different distribution of Linux but was tested on Ubuntu and Fedora only at this time.
Windows user, you need to install a Unix shell like cygwin or Git for Windows, but the sample requires bash 3.2 minimum to run. See the Windows special setup instructions for more details.
Windows user, see Windows special setup instructions below first.
curl -V
brew install jq
The ./forge scripts provide quick help information for the commands and arguments.
A typical workflow is:
# Do authentication
./forge 2legged
# Create a bucket. Bucket name must be lower case and valid characters
./forge bucketCreate my_bucket_name
# Upload a model
./forge upload samples/Au.obj
# Translate the model
./forge translate Au.obj
# Wait until the translation completes.
# Translation is complete when it reaches 'success - 100%'
./forge translateProgress Au.obj
# Retrieve preview image (png saved into ./temp/)
./forge thumbnail Au.obj
# View the model in your localhost WEB site (html saved into ./temp/)
./forge html Au.obj
Note your access token and bucket name are saved in the data folder to be used as default by the scripts, but you can edit them as you wish.
Bucket information (JSON replies) returned by the system is stored in the data folder as well.
This sample was tested on Windows with the git for windows package. It provides a nice terminal windows running Bash v4.3 and cUrl v7.51 already installed.
"C:\Program Files\Git\git-bash.exe" --cd-to-home
This sample is licensed under the terms of the MIT License. Please see the LICENSE file for full details.
Cyrille Fauvel
Forge Partner Development
http://developer.autodesk.com/
http://around-the-corner.typepad.com