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.
need a guide to figure out using Postman to access API
alan_baljeu Member, User Group Leader Posts: 111 ✭✭
I thought maybe I had done this before, but seems not. I am getting Unauthorized errors and the like. I put in access tokens, and all the oauth things (maybe some of these I'm doing wrongly), but I'm stuck. It seems likely it's too complex a problem to address via forum, but if anybody knows how to do Postman maybe you can walk me through doing it right.
Creating knowledge-driven design automation software, for molds, etc.
On a second look, maybe it competes with glassworks, have you seen this one?
I only know about glassworks as the tool that has the forms for all the standard Onshape queries. But if you wanted to prepackage specific queries, I don’t see that. Not that this is necessary; in general I can do all these things in a programming language, but Postman has a certain immediacy to it like glassworks, if only I could get it working through the oauth barrier.
Do you write with CADL?
I do actively work on XMD, which is in C# and C++. CADL, now KXL, is the scripting language for Cadkey/KeyCreator. I’m familiar with it, but don’t actively use it. It’s quite limited compared to the C++ API.
The Onshape development is a new project not directly connected to XMD. We’re aiming at a more open system where the automation can be customized to your requirements.
I started with cadkey and knew cadl well. We use to hang out on a compu-serve forum discussing CAD the same as we do here. Did you know any of the players from those days? Do you remember Robert White, the guy who wrote fastsurf?
We started working with PTC before Kubotek bought Cadkey. I don't know what happen to Cadkey after that point in time.
Did you ever get oauth2 working with Onshape? I'm not sure how different postman's oauth is vs onshape's. I didn't have much trouble with onshape oauth2 but I don't really use it any longer. I'm using the api-key mostly these days which allows my web server (rustyshed.com) to access my onshape account and pull data down from onshape.
Yes oauth2 is working for me. I am not clear what the API key does different from oauth2.
On a remote server, there is no login. On rusty shed, I don't have to be involved for my site to gain access to my data. If someone comes to my site, my site can still get my data even though I'm on vacation. With the api-key, you never have to login. It's a small thing but better when developing a site that's showing off your own designs.
To show someone else's design on my site, all they have to do is share it with me. There is no oauth2 involved with that.
When developing my site, I always had to login to onshape to work on my site. That oauth2 login dance gets to be annoying after a long day of site programming.
The problem with the api-key is that it only works on one account, in my case, my account.
Is postman's oauth different than onshapes?
Bob (Robert) taught me surfacing. That's all that guy knew and the only thing he talked about. I liked Cadkey and wished they never dongled it. I think it could have competed with autocad and possibly won the cad battle.
postman is a clientside tool. It acts like a web browser to a server, except it’s specifically oriented to managing and showing all the data that goes on behind the scenes, instead of doing the web page display. It has spots for configuring oauth info that it would send to whatever server. It looks compatible in terms of the fields, but it has additional stuff, and it hasn’t worked for me. Given the tool’s maturity, there ought to be a way to make it work, but I got lost in the mud trying to figure it out.
Technically Cadkey could have overtaken AutoCad, but the sales and marketing of the organization weren’t at the same level. And AutoLisp was a huge differentiator I think. Kind of like Featurescript I believe will be Onshape’s differentiator long after everyone else has an online system.
I'm able to do the oauth steps and run api commands via postman.
Have you done the following:
1. Browse to https://oauth.onshape.com//oauth/authorize?response_type=code&client_id=[your client id]
2. Log in
3. Your redirect to your app should fail to load (set it to an invlaid localhost url to ensure this), but you just need the redirect url to get the "/code=[some code]" portion
4. In postman, do the https://oauth.onshape.com/oauth/token call with the following setup:
replacing the clientid, client secret, and code.
5. In step 4, you'll you will get an "access_token"
6. Then to do your request, and set the header "Authorization" to "Bearer YOURACCESSTOKEN"
The bearer is part of the value, its weird, but it works.
The rest of the header is just the defaults that postman uses.
Setup exactly as below, you should get a successful response.
If it doesn't work, shoot me an email.
We specialize in custom FeatureScripts, and Onshape integrated applications
I knew autolisp also, I liked cadl much better and Cadkey was more fun to program because it was 3D. I sold Cadkey when ever we could but "free" always seemed to win out.