Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
help getting started with api
alan_baljeu
Member, User Group Leader Posts: 111 ✭✭
I cannot find the API Explorer. I found it in the store, subscribed, and it says it should be in OnShape in the + menu.
Creating knowledge-driven design automation software, for molds, etc.
www.virtualmold.com
www.virtualmold.com
0
Comments
you need to open a document first. Then follow the screenshot below:
https://dev-portal.onshape.com/
Is this by clicking "Create new OAuth Application"? Do I want to make up form answers for a temporary/test application, and then I will get those two keys? Do I need to pick an url on my website to get started?
Once I get the keys how do I get a test page running to prove the system is available?
www.virtualmold.com
There's 3 computers involved and you have to keep the code seperated for each computer. All the computers have a task.
I'm using nodejs, so it's really confusing, is it client code, server code or is it an onshape json object.
Sounds like I need to create a video.
There are two example sets; one Javascript and one python. I chose to use the node javascript vs the python. I did not know either language. Javascript is similar to featurescript. Javascript will also will help you in building a front end. Get this working and this will be the engine of your middleware.
You can use node express as a middleware server. For example; to run getDocuments.js though a local middleware server. You make calls to the node express server [ https://www.youtube.com/watch?v=lY6icfhap2o] which then calls getDocuments.js which then calls app.js which then calls onshape.js.
To develop I initially use API Keys in Onshape. I then use 'REST Client' which is an add-on to Code to test my calls. Once everything is working I add them into my front end code.
Hopefully this does not totally confuse you! Just remember you need three things: 1. Client 2. Middleware (explained above) 3. Backend (onshape)
www.virtualmold.com
Try
I think the easiest way to test is run a node.js server locally.
AWS gets very tricky quickly. Once your free tier runs out, AWS pricing is very hard to follow. After getting charged a large bill, I only use it for S3 now.
If you need online testing, move your local server to heroku, digital ocean, or one of the other many hosts. Digital Ocean gives you server, static, and a mongodb for around $5/month. I push to git locally and pull from git on digital ocean.
I think I will use DigitalOcean.
www.virtualmold.com
I also use amazon for email & pay. It's not as easy, not organized from beginning to end. Where do you start? It's easy to get lost and hard to find an answer.
Bill, can you run nodejs from a local computer and talk to onshape? I thought you needed a secure socket otherwise onshape won't talk to you. I'm using let's encrypt on my server droplet which let's me talk to onshape securely (https). How are you encrypting your local computer? I've never really thought about encrypting my local computer.
I'm running nginx which handles let's encrypt. , I run a nodejs instance over 127.0.0.0. Doing this allows nginx server caching.
When I was researching this a few years ago, I went with:
-digital ocean
-unbuntu
-nginx
-nodejs
And this came out:https://rustyshed.com/
Can you get responses back from onshape with a computer running nodejs?
Here is where I started: https://github.com/onshape-public/apikey/tree/master/Node
It took me a while to get it to work, but the instructions are actually straight forward. Just like riding a bike... I can do a video if you would like.
I am not 100% sure how encryption is handled? It does use "crypto" to send the secret key.
From there I took a MERN Stack class and placed the Onshape calls behind a secure Express server. I went with MERN because this keeps everything javascript which is also Featurescript. A MEAN Stack should do the same.
I think you're right, crypto & https build that crypto-nonce allowing communication.
It's interesting that it'll work with a local client/server & onshape.
If you have the time, please put together a video on how you built up your local client/server. I'm interested.
If you don't want to type it all out, just download both githubs and npm install...
I've been working with amazon pay lately, which is the same thing as what Bill's doing with Onshape. One thing to note for those who are interested in what Bill is doing above, it's a new paradigm for programming the cloud and worth learning. Learning the Onshape API opens up a new world for engineers. A modern world.
What I have at the end is a boilerplate ERN Stack for the Onshape API. Express for server, React for client (this forum is React), Node for backend which talks to Onshape. I think this is the easiest starting point for someone new since everything is javascript.
Hi @bill_schnoebelen I wanted to congratulate you on the video. It helped me to understand the API a little more.
((( https://www.thingiverse.com/thing:33327 )))
For that I would use a gltf. Separate it into three problems.
1. Display gltf in client. Use a threejs library. I like model-viewer. At this stage manually save a gltf and load it in the client.
2. Export the glft from Onshape. You have to make three calls. 1. Get gltf ready 2. Is it ready? I just loop until I get a yes answer. 3. Download. This is explained in the Onshape documentation.
3. Bring it all together. Make a call from the client to the server to download gltf. You can follow export stl. You may have to change it to a post depending on how your getting the file.
You could also just use the stl file, but I have found these to be a pita for web display. gltf seems to be the dominant choice.