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
Pre-Requisites
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.
Running On: Cloud Connector Host
Host: cad.onshape.com
Port:443
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
Document ID: Unique identifier of the Document which will be used to carry out the other tasks.
Document Name: The display name of the Document.
Workspace ID: Unique identifier of the Document Workspace which will be used to carry out the other tasks.
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
Document ID
Workspace ID
Required Output Extractor
Element ID: Unique identifier of the Element which will be used to carry out the other tasks.
Element Name: The display name of the Element.
Element Type: The type of the Element.
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
Document ID
Workspace ID
Element ID
Element Type
Required Output Extractor
Element ID: Unique identifier of the Element which will be used to carry out the other tasks.
Element Name: The display name of the Element.
Element Type: The type of the Element.
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
Document ID
Workspace ID
Element ID
Required Output Extractor
Body ID: Unique identifier of the Body which will be used to carry out the other tasks.
Body Type: The Part Body Type.
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
Document ID
Workspace ID
Element ID
Required Output Extractor
Low X: Value of lowX.
Low Y: Value of lowY.
Low Z: Value of lowZ.
High X: Value of highX.
High Y: Value of highY.
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
Document ID
Workspace ID
Element ID
Part ID
Required Output Extractor
Part ID: Unique identifier of the Part which will be used to carry out the other tasks.
Part Type: The Part Type.
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
Document ID
Workspace ID
Element ID
Required Output Extractor
Instance ID: Unique identifier of the Instance which will be used to carry out the other tasks.
Instance Name: The Instance Name.
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
Document ID
Workspace ID
Element ID
Required Output Extractor
Low X: Value of lowX.
Low Y: Value of lowY.
Low Z: Value of lowZ.
High X: Value of highX.
High Y: Value of highY.
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
Document ID
Workspace ID
Element ID
Required Output Extractor
Bill Material ID: Unique identifier of the Bill of Material table.
Bill Material Name: The Bill of Material table Name.
Bill Material Type: The Bill of Material table Type.
Additional parameters that are returned with the response are included as part of the output parameters.