flowchart LR
A([Create APS App]) --> B[getToken]
B --> C[makeBucket]
C --> D[uploadFile]
D --> E{Use case}
E --> F[translateObj / translateSvf]
E --> G[makePdf]
E --> H[createPhotoscene]
F --> I[viewer3D]
Getting Started
Five steps stand between you and your first successful API call. By the end of this chapter you’ll have credentials stored safely, AutoDeskR installed, and a file sitting in a cloud bucket ready for translation.
System Requirements
- R 4.0 or later
- RStudio (optional but recommended)
- An internet connection
- A free AutoDesk account (created below)
Step 1: Create an AutoDesk Account
If you do not already have an AutoDesk account, register for free at autodesk.com. A standard account gives you access to the APS free tier, which is sufficient for development and moderate usage.
Step 2: Register an APS Application
APS uses OAuth 2.0 — every API call needs a token, and every token comes from a registered app. Here’s how to get one:
- Go to the APS Developer Portal and sign in.
- Click My Apps → Create Application.
- Give your app a name (e.g.,
AutoDeskR-dev) and enable the APIs you need. For the examples in this book: Data Management, Model Derivative, and Design Automation. - Click Create. Your Client ID and Client Secret appear on the app detail page.
Keep these private. If they end up in a public Git repo, rotate them immediately.
Step 3: Store Credentials Securely
The safest way to use credentials in R is through environment variables stored in ~/.Renviron. Open or create that file:
usethis::edit_r_environ()Add the following lines, replacing the placeholder values:
client_id=your_client_id_here
client_secret=your_client_secret_here
Save the file and restart R. You can then retrieve the values in any script without hard-coding them:
id <- Sys.getenv("client_id")
secret <- Sys.getenv("client_secret")See the Authentication chapter for a full explanation of OAuth scopes and token management.
Step 4: Install AutoDeskR
Install the stable release from CRAN:
install.packages("AutoDeskR")Or install the development version from GitHub:
devtools::install_github("paulgovan/AutoDeskR")Step 5: Your First Workflow
The diagram below shows the typical flow through the AutoDeskR APIs:
The following code demonstrates a complete round-trip: authenticate, create a storage bucket, upload a file, and verify the upload.
library(AutoDeskR)
# Read credentials from environment
id <- Sys.getenv("client_id")
secret <- Sys.getenv("client_secret")
# 1. Get an access token with the scopes needed for data management
token <- getToken(id, secret, scope = "data:read data:write bucket:create bucket:read")
token$content$access_token
#> [1] "eyJhbGciOiJSUzI1NiIsImtpZCI6IlU3c1BKNVVpOWNaVjlIR2FhX1pIeDhEd3VYSHcifQ..."
token$content$expires_in
#> [1] 3600
# 2. Create a persistent storage bucket (bucket names must be globally unique)
bucket <- makeBucket(token, bucketKey = "my-first-autodeskr-bucket", policyKey = "persistent")
bucket$content$bucketKey
#> [1] "my-first-autodeskr-bucket"
bucket$content$policyKey
#> [1] "persistent"
# 3. Upload a local file (≤100 MB)
result <- uploadFile(token,
localPath = "path/to/your/file.dwg",
bucketKey = bucket$bucketKey)
result$content$objectKey
#> [1] "file.dwg"
result$content$size
#> [1] 3145728
# 4. List objects in the bucket to confirm the upload succeeded
objects <- listObjects(token, bucketKey = bucket$bucketKey)
print(objects$content$items)
#> objectKey objectId size
#> 1 file.dwg urn:adsk.objects:os.object:my-first-autodeskr-bucket/file.dwg 3145728If the upload succeeds, listObjects() will return a data frame containing your file’s objectKey, objectId (a URN), and size. The objectId is used in subsequent chapters when translating the file or loading it in the viewer.
What’s Next
With your credentials configured and a file uploaded, you are ready to explore the full API:
| Chapter | What it covers |
|---|---|
| Authentication | Token scopes, token refresh, rate-limit handling |
| Data Management | Buckets, large-file uploads, pagination |
| Model Derivative | Translating files to OBJ, STL, SVF; extracting metadata |
| Design Automation | DWG-to-PDF conversion pipelines |
| Reality Capture | Photo-to-3D mesh from drone or phone images |
| Viewer | Embedding the 3D viewer in Shiny and R Markdown |
| Mesh Reading | Importing OBJ and STL files; inspecting geometry |
| Mesh Metrics | Surface area, volume, bounding box |
| 3D Visualisation | Interactive rgl widgets and rayshader renders |
| Point Cloud Analysis | LAS/LAZ files; height normalisation; density rasters |
| Layer Analysis | Counting and summarising DWG layers |
| Attribute Extraction | Reading object properties from Model Derivative |
| Cross-Drawing Comparison | Diffing layer tables across drawing revisions |
| Drawing Reports | Parameterised gt reports rendered with Quarto |
| Tandem Overview | Connecting to AutoDesk Tandem facilities |
| Sensor Streams | Fetching live sensor readings |
| Live Dashboards | Viewer + sensor chart in a single Shiny app |
| MCP Server | Exposing AutoDeskR as an AI agent tool |
| Troubleshooting | Common errors and how to fix them |