App Development

The primary APIs provided by Onshape are REST interfaces that can be accessed over HTTPS. The client can be a web server or a desktop application (including command line tools, such as curl). Onshape does not support use of the APIs directly from a browser client due to cross-domain scripting concerns.

Partner applications typically interact with Onshape in three ways:

  • File Exchange: Onshape provides extensive import and export translation capabilities to interact with applications that can read or write a variety of file formats.
  • Live Link Integration: Desktop or server applications can use REST calls to read information from the Onshape servers and store information back. These applications can gain “cloud value” by using Onshape data management capabilities for sharing, versioning, and durability.
  • In-Tab Integration: Web server applications can create a tightly integrated experience within Onshape by using a combination of REST and client-side APIs to build a seamless interaction by interacting with users inside an Onshape tab.

The following diagram illustrates basic desktop integration and cloud integration architecture:

images

The Onshape Server Stack consists of several cooperating servers that provide the underlying support for the Onshape CAD experience. The Onshape servers are built with a variety of technologies, including Java and C++, database and message services, geometry and constraint management systems, and much more.

Partner cloud applications can be written in any web framework. Onshape provides a set of sample apps in Github.

Create an application

Note

These steps are for creating a private application on a personal account. To create an internal application for a company, classroom, or enterprise, see Enterprise Settings: Developer.

  1. For personal accounts, go to the dev portal: https://cad.onshape.com/appstore/dev-portal/.
  2. Click OAuth applications in the sidebar.
  3. Click the Create new OAuth application button.
    Create an application in the dev portal
  4. Fill out the form:
    Create an application form in the dev portal
    • Name: Application name
    • Primary format: com.example.example
    • Summary: Brief summary of the app
    • Redirect URLs: URL of the app landing page
    • Permissions: Select the applicable permissions
    • OAuth URL: URL for the OAuth login. ⚠️ WARNING: All applications must authenticate with OAuth2 to be approved in the Onshape App Store.
  5. Click Create application.
  6. A window opens with your OAuth key and secret. You cannot find this secret again, so store it securely.

Next, see:

  1. Hello World - Open a webpage in the Onshape UI.
  2. OAuth2 - ⚠️ WARNING: All applications must authenticate with OAuth2 to be approved in the Onshape App Store.
  3. App Store - Learn about submitting apps to the Onshape App Store.

Integration considerations

Onshape differs from many traditional CAD and PDM systems, and thus requires unique considerations. Key integration best practices include:

  1. Do not limit the capabilities of the software: When applying integration practices of legacy file-based solutions to Onshape, you must adjust the way designers work in Onshape to accommodate the limitations of your integration. The integration should follow best practices and methodologies that can be applied to modern SaaS-based solutions.
  2. Enable designers the freedom to work without constraints: Designers working in a CAD system should never be restricted in their ability to use the software features to the fullest. The software is designed to provide its users with the freedom to innovate and the flexibility to adjust to how a designer wants to work.
  3. Utilize the best in class features from each solution: Different software solutions provide different functionality. For instance, a CAD system should have best-in-class tools for modeling, whereas data management tools should provide capabilities to manage, analyze and report on data. While there might be overlap between systems, it is best practice to let each software solution do exactly what it was designed to do, instead of forcing one to perform the functions of the other.
  4. Map out your business processes: Decide which software solution is responsible for each part of the process. It is impossible to develop a successful integration if the requirements are not clear. The business processes managed through the integration should be mapped out, along with the systems involved and which system is responsible for which function.
  5. Use standards and published APIs: Developers hate when thousands of lines of code and days of work are thrown away because of a software upgrade. Using industry standards and published APIs protects your code from this disaster.

Resources