/
RestAPI

RestAPI

What is RestAPI?

Flowster Studio uses Rest API to allow clients (browser apps) to communicate with a server. An API is an application programming interface that consists of a set of rules that allow programs to talk to each other. REST determines how the API looks like. It stands for “Representational State Transfer” and defines a set of rules that developers follow when they create their API. One of these rules states that you should be able to get a piece of data (called a resource) when you link to a specific URL. Each URL is called a request while the data sent back to you is called a response. REST APIs accepts JSON for request payload and also send responses to JSON. 

API Authentication is the process of authenticating users who try to access private API calls before making data available to them directly. This can be achieved by using JSON Web Tokens. JSON Web Tokens are an open and standard way for you to represent your user's identity securely during a two-party interaction. That is to say, when two systems exchange data you can use a JSON Web Token to identify your user without having to send private credentials on every request.


In comparison with previous versions of Flowster Studio 4.8.x where additional settings were needed before invoking RestAPI methods ( e.g. create or use an existing Client Hash from a Client App, Set Token for a user in Client App Security), for the new RestAPI, only a username (with permissions to access Flowster Studio) and password are required to obtain the JWT to authorize additional requests. 


RestAPI Client App

This client app is configured during installation to be later used for third-party scripts invoking RestAPI methods. The RestAPI documentation URL is added as a Setting for the client app:

In order to invoke deprecated RestAPI methods, users require the following information from the client app's configuration:

  • Hash value from the client app's Info tab 
  • User account from the client app's Security tab. The account is requested during installation, together with the password that is set automatically to obtain the access token. The password inserted during installation should match the password used in the scripts. Users can change the password provided during installation by selecting the assigned user and click the Set Password button. The user account is also added in the Security Groups in a user type group created for the RestAPI client app configuration
  • RestAPI Endpoint from the client app's Security tab. Select the user account which has the password set and the RestAPI Endpoint will be automatically displayed

In order to invoke new RestAPI methods, users only require the RestAPI Endpoint and credentials for a user account with permissions in Flowster Studio. It doesn't need to be the user account from the client app's Security tab (that user is configured during installation only to provide backwards compatibility with deprecated methods from previous versions of Flowster Studio that required special settings for the RestAPI client app), it can be any user account with permissions in Flowster Studio. 


The RestAPI Endpoint can also be extracted from the setting mentioned above deployed with the format: RestAPI Endpoint/swagger. For example, if the documentation URL is https://demoserver:5500/swagger, then the RestAPI Endpoint is https://demoserver:5500. 

Visit the RestAPI Documentation URL for more details about the available methods to be invoked:


NOTES:

  • The methods from Flowster 4.8.x are still available for usage and should be used as before. They are exposed for backwards compatibility and are visible in the RestAPI documentation page with the suffix Deprecated (Please keep in mind that in the future versions of Flowster Studio, these methods will not be supported anymore and they need to be replaced with the new RestAPI methods). 
  • The methods from Flowster 4.8.x under Assets and Global Variables are not supported anymore in the new RestAPI. For instance related operations (Assets), please adapt your scripts to use FlowsterInstance methods.  


Code Samples

The archive for RestAPI code samples can be downloaded HERE (The zip contains the deprecated code samples and a new methods code samples for the new RestAPI).

In order to send requests to the new RestAPI, follow the steps below:

  • Create the request for the access token  - adapt the script to your scripting language. Powershell is used as example below:


  • Create next requests based on desired operations - for more details regarding each method, go to RestAPI Documentation URL. In the example below, the first tenant ID  of the requested user is returned:

Related content

RestAPI
More like this
RestAPI
More like this
Authorization and Authentication
Authorization and Authentication
More like this