This article describes how you get started with the SystemWeaver REST API once it has been installed and configured


The SystemWeaver REST API can be used to access your SystemWeaver server through an HTTP-based interface. The SystemWeaver REST API is still under development and new features are added every release.


Outstanding Issues and Features for R33

The following known items will be addressed in later releases. 


Types

There are no endpoints for Item, Part and Attribute Types.


Attributes

Computed attributes are not managed.


Projects and Issues

It is not possible to create and edit projects and their setups.

It is not possible to create Issues.


Users

It is not possible to edit or create users.

It is not possible to get, edit or create user groups.


Outstanding Issues and Features for R32

The following outstanding issues from R32 are fixed unless they are listed above as outstanding for R33.


Asynchronous calls not supported for a connection

The SystemWeaver REST API does not support asynchronous calls from a single connection. This will be implemented in the next release. If multiple calls are performed at the same time for a connection, the SystemWeaver REST API will throw an error message.


No write operations available

The SystemWeaver REST API has no support for write operations in this release. Support for editing Items, Issues, Libraries, etc. will be incrementally added in upcoming releases.


Attributes

Computed attributes are not managed.

RVF attributes are not managed.


Types

There are no endpoints for Item, Part and Attribute Types.


Finding the REST API server

Contact your organization's IT department to get the URL of the SystemWeaver REST API for your SystemWeaver server.


Authenticating Towards the SystemWeaver Server

The SystemWeaver REST API uses basic HTTP authentication and OAuth 2.0 to authenticate users. 


Important Note: It is strongly recommended that SSL is turned on for the REST API. If not SSL enabled, user credentials will be sent in clear text between the clients and the REST server.


When logging in, the user provides username and password. If the credentials are accepted, a token will be provided. A refresh token is also supplied with the response. The refresh token is used for prolonging the access token time.


Retrieving a Token

The below examples show a server authentication request using curl where the server is located on the URL: http://sys76:9000


The token itself can be retrieved from {URL}/token:

curl -X POST http://sys76:9000/token -d 'username=fredrik.systemite&password=test&grant_type=password' 

If successful, it produces a response on the following form containing an access token and a refresh token:

{"access_token":"AQAAANCMnd8BFdERjHoAwE_Cl-sBAAAAZIzMKT_UMU6BqHdaJYNmigAAAAACAAAAAAADZgAAwAAAABAAAABLiECOrM3COk42PmO0cYWsAAAAAASAAACgAAAAEAAAAJAxZUh0GEQCen7DvWN-qrSwAAAAAAEwnDyoRNz1JFO9DBEsOvWZ6TG23DkOfWMP34LV-esxHNMpTXY81dcwlTk3EuMCq3tIcUFKxCOdVtY_BstcgI2NEaEnoyOTyR9qBHtND_lMRqFWBF-lhyNNu-9ey5q272rs9vBcJ59H4-sHzKqLtlu2_wd12zzquUF9pJ4ERfLNc2tr0wyxB4vbhgJrGmFCsqQjlcBMkHRRgWAfu1RB00e5pH3g6mTa91bpyGZ_3UIUAAAAVtKrhBNXPe7LjWQzMta7KFZdWHY",
"token_type":"bearer",
"expires_in":119,
"refresh_token":"1b5a6146-8591-49c0-b4b2-9b9a0754efab"}

Retrieving a New Token Using Refresh Token

The below example shows how to use the refresh token from the response above to acquire a new access token. The response has the same format as when retrieving a token the first time:

curl -X POST http://sys76:9000/token -d  'grant_type=refresh_token&refresh_token=1b5a6146-8591-49c0-b4b2-9b9a0754efab'
Note: When logging in using the SystemWeaver REST API, the connection will be reserved for the duration of the refresh token's expiration time which is ten minutes.

Retrieving an Item Resource

The below example shows how to retrieve information about an Item for a given handle using the access token from the login example:

curl -X GET http://sys76:9000/restapi/items/x04000000000000B7 -H 'Authorization: Bearer AQAAANCMnd8BFdERjHoAwE_Cl-sBAAAAZIzMKT_UMU6BqHdaJYNmigAAAAACAAAAAAADZgAAwAAAABAAAABLiECOrM3COk42PmO0cYWsAAAAAASAAACgAAAAEAAAAJAxZUh0GEQCen7DvWN-qrSwAAAAAAEwnDyoRNz1JFO9DBEsOvWZ6TG23DkOfWMP34LV-esxHNMpTXY81dcwlTk3EuMCq3tIcUFKxCOdVtY_BstcgI2NEaEnoyOTyR9qBHtND_lMRqFWBF-lhyNNu-9ey5q272rs9vBcJ59H4-sHzKqLtlu2_wd12zzquUF9pJ4ERfLNc2tr0wyxB4vbhgJrGmFCsqQjlcBMkHRRgWAfu1RB00e5pH3g6mTa91bpyGZ_3UIUAAAAVtKrhBNXPe7LjWQzMta7KFZdWHY'

API Documentation

The SystemWeaver REST API uses Swashbuckle to generate API documentation. The documentation can be accessed in a web browser from {url}/documentation. Based on the above example, it would look like this: http://sys76:9000/documentation