Example WEBAPI Access

BCranstonBCranston Moderator Posts: 38 mod
I'm not an API guy (yet) so forgive me if my terminology is off. The Adept WEBAPI is documented in parallel on your Adept Web Client server.

As an example, this link should let you query your Adept server based on a field search criteria.
http://{your-server-name}/Synergis.WebAPI/swagger/ui/index#!/Document/Document_GetDocumentSearchByFields

I enter search criteria I expect should return results but it fails because I don't have an authorization token.  Where or how do I get one?  Should this even work?

Thanks,
-Brian

Comments

  • ElaineWElaineW Member Posts: 12

    Here is some information that should help. 

    The page displayed when a user browses to http://localhost/synergis.webapi/swagger/ui/... Is a part of a self-documenting framework called Swagger that we use to display the WebAPI object model. We’ve used the framework as it’s provided without much modification and some of the “out of the box” features and buttons on the interior pages are not implemented. It’s best used as a point of reference at this time.

     

    Specifically as it relates to issuing commands and logging in, The WebAPI, which powers the Web Client as well as the new class of 2018 Task Panes (currently as of the 2018 release, the SOLIDWORKS 2018 Task Pane) require a mechanism to first login in and then gain an access token that is regularly refreshed – this is an important aspect of application security in the new architecture. In order for any WebAPI search to be successful, the issuer must have a valid token and it must be regularly refreshed. The error is being displayed because one or both of these conditions is not true. The token referred to is called a Bearer Token, and has to be acquired by successfully logging in to the Adept WebAPI. The Bearer Token is returned as data from the WebAPI Login call and that token must be passed in along with any subsequent WebAPI calls. This mechanism protects the Adept Web Server from unauthorized access.

     

    A search request issued from this page is unlikely to be successful at this time, especially since tokens must be refreshed at regular intervals measured in seconds. We encourage our customers that want to get a deeper understanding of developing applications using the WebAPI to participate in an API Training class, it will help tremendously in their understanding of how this and other mechanisms in the new architecture work.


Sign In or Register to comment.