Introduction

Onshape's REST API allows the users to interact with Onshape having the right access set to their respective Onshape accounts. The Goal of this connector is to integrate Tulip with Onshape using HTTP Connectors & provide our customers with an out of box connector that can be imported into their instance.

Purpose

We are going to highlight different connector functions that can be built by doing HTTP calls to Onshape REST API to interact with the Onshape system to showcase various read and write actions on the Onshape that could be leveraged for various use cases.

API Doc

Onshape API Overview

Pre-Requisites

  1. Create an account on Onshape & configure the OAuth2 credentials.

2. Register API with the required scopes in Onshape.

Tulip Connection Details

The following information would need to be configured on Tulip’s

Connectors.

  1. Running On: Cloud Connector Host

  2. Host: cad.onshape.com

  3. Port:443

  4. TLS: Yes

OAuth 2: Authentication will be carried forward to all

the Connector Functions

Connector Functions

Get all Documents

Purpose

This connector will fetch all the documents in a user's Onshape workspace.

Endpoint

HTTP GET call to the endpoint: https://cad.onshape.com:443/api/documents

Required Input

No Inputs required

Required Output Extractor

  1. Document ID: Unique identifier of the Document which will be used to carry out the other tasks.

  2. Document Name: The display name of the Document.

  3. Workspace ID: Unique identifier of the Document Workspace which will be used to carry out the other tasks.

  4. Additional parameters that are returned with the response are included as part of the output parameters.

Get all Elements of a Specific Document

Purpose

This connector will fetch all the elements of a specific document by passing the required inputs.

Endpoint

HTTP GET call to the endpoint: https://cad.onshape.com:443/api/documents/d/{DocumentID}/w/{WorkspaceID}/elements

Required Input

The following are the URL parameters that are to be passed

  1. Document ID

  2. Workspace ID

Required Output Extractor

  1. Element ID: Unique identifier of the Element which will be used to carry out the other tasks.

  2. Element Name: The display name of the Element.

  3. Element Type: The type of the Element.

  4. Additional parameters that are returned with the response are included as part of the output parameters.

Get Element Properties

Purpose

This connector will fetch all the element properties of a specific element type part of a document.

Endpoint

HTTP GET call to the endpoint: https://cad.onshape.com:443/api/documents/d/{DocumentID}/w/{WorkspaceID}/elements?elementType={ElementType}&elementId={ElementID}

Required Input

The following are the URL parameters that are to be passed

  1. Document ID

  2. Workspace ID

  3. Element ID

  4. Element Type

Required Output Extractor

  1. Element ID: Unique identifier of the Element which will be used to carry out the other tasks.

  2. Element Name: The display name of the Element.

  3. Element Type: The type of the Element.

  4. Additional parameters that are returned with the response are included as part of the output parameters.

Get Part Studio Body Details

Purpose

This connector will fetch all the body details of a Part Studio element of a specific document by passing the required inputs.

Endpoint

HTTP GET call to the endpoint: https://cad.onshape.com:443/api/partstudios/d/{DocumentID}/w/{WorkspaceID}/e/{ElementID}/bodydetails

Required Input

The following are the URL parameters that are to be passed

  1. Document ID

  2. Workspace ID

  3. Element ID

Required Output Extractor

  1. Body ID: Unique identifier of the Body which will be used to carry out the other tasks.

  2. Body Type: The Part Body Type.

  3. Additional parameters that are returned with the response are included as part of the output parameters.

Get Part Studio Bounding Boxes

Purpose

This connector will fetch all the bounding boxes of a Part Studio element of a specific document by passing the required inputs.

Endpoint

HTTP GET call to the endpoint: https://cad.onshape.com:443/api/partstudios/d/{DocumentID}/w/{WorkspaceID}/e/{ElementID}/boundingboxes

Required Input

The following are the URL parameters that are to be passed

  1. Document ID

  2. Workspace ID

  3. Element ID

Required Output Extractor

  1. Low X: Value of lowX.

  2. Low Y: Value of lowY.

  3. Low Z: Value of lowZ.

  4. High X: Value of highX.

  5. High Y: Value of highY.

  6. High Z: Value of highZ.

Get Metadata of an Individual Part

Purpose

This connector will fetch the metadata of an individual part of a Part Studio element of a specific document by passing the required inputs.

Endpoint

HTTP GET call to the endpoint: https://cad.onshape.com:443/api/metadata/d/{DocumentID}/w/{WorkspaceID}/e/{ElementID}/p/{PartID}

Required Input

The following are the URL parameters that are to be passed

  1. Document ID

  2. Workspace ID

  3. Element ID

  4. Part ID

Required Output Extractor

  1. Part ID: Unique identifier of the Part which will be used to carry out the other tasks.

  2. Part Type: The Part Type.

  3. Additional parameters that are returned with the response are included as part of the output parameters.

Get Assembly Definition

Purpose

This connector will fetch the assembly definition of an Assembly element of a specific document by passing the required inputs.

Endpoint

HTTP GET call to the endpoint: https://cad.onshape.com:443/api/assemblies/d/{DocumentID}/w/{WorkspaceID}/e/{ElementID}

Required Input

The following are the URL parameters that are to be passed

  1. Document ID

  2. Workspace ID

  3. Element ID

Required Output Extractor

  1. Instance ID: Unique identifier of the Instance which will be used to carry out the other tasks.

  2. Instance Name: The Instance Name.

  3. Additional parameters that are returned with the response are included as part of the output parameters.

Get Bounding Boxes of an Assembly

Purpose

This connector will fetch all the bounding boxes of an Assembly element of a specific document by passing the required inputs.

Endpoint

HTTP GET call to the endpoint: https://cad.onshape.com:443/api/assemblies/d/{DocumentID}/w/{WorkspaceID}/e/{ElementID}/boundingboxes

Required Input

The following are the URL parameters that are to be passed

  1. Document ID

  2. Workspace ID

  3. Element ID

Required Output Extractor

  1. Low X: Value of lowX.

  2. Low Y: Value of lowY.

  3. Low Z: Value of lowZ.

  4. High X: Value of highX.

  5. High Y: Value of highY.

  6. High Z: Value of highZ.

Get Assembly Bill of Materials

Purpose

This connector will fetch the bill of materials of an Assembly element of a specific document by passing the required inputs.

Endpoint

HTTP GET call to the endpoint https://cad.onshape.com:443/api/assemblies/d/{DocumentID}/w/{WorkspaceID}/e/{ElementID}/bom

Required Input

The following are the URL parameters that are to be passed

  1. Document ID

  2. Workspace ID

  3. Element ID

Required Output Extractor

  1. Bill Material ID: Unique identifier of the Bill of Material table.

  2. Bill Material Name: The Bill of Material table Name.

  3. Bill Material Type: The Bill of Material table Type.

  4. Additional parameters that are returned with the response are included as part of the output parameters.

Did this answer your question?