REST Data Source

Last modified on 2023/07/03 13:21

Apps - Datasource - JSON Online icon.png This data source belongs to the Online category in the data source library. It is used to access, via a connector, the resources of a service (websites or third-party products) in order to retrieve dynamic content.

REST_ServiceResourceAuthentication
  • Services offer different types of content and data via resources.

example  Twitter  ==> Timeline or followers

  • Data may be public and accessible to everyone (no user authentication required) or private. In this case, user authentication is required before the resource can be accessed.

    example  Content read in Google Calendar, Google Contacts, Twitter 

  • Data is read in the resource and sent to Service Apps) in JSON format.
    • This data can be displayed using widgets. The Selector tool integrated in the data source is used to extract only the data you want.
    • Data is then automatically refreshed each time that the data source is modified.

Examples

REST_Examples
  • No user authentication:

==> Thanks to REST architecture, the position of the ISS can be displayed using a Google Maps widget without requiring user authentication.

  • Using Basic authentication:
    • Creation of a timeline customized by each Twitter user.

==> Thanks to REST architecture and the REST API adopted by Twitter, tweets in a user's timeline can be displayed using a Data Viewer widget with prior user authentication.

  • Salesforce enables users to have different views of corporate data, e.g. lists of customers, prospects, projects or sales employees.

==> The REST protocol enables you to display these resources using Data Viewer widgets with prior user authentication.

Notes

     Open url.png  See General remarks on data sources.

  • The type of authentication that can be used depends on the API set up by each service and is described in the API documentation of the service.
  • To find out more about the JSON table structure, please consult http://www.json.org.

Caution

  • Basic authentication encrypts and stores the login information required by the service in Service Apps.

Best Practice

  • If different authentication methods are available for a given service, we recommend that you use OAuth 2.0 authentication whenever possible. In this case, you must use the REST (Connector) data source.
REST_DataSourcesRESTComparizon

How to choose between a REST data source and a REST (Connector) data source

  •  You should use a REST (Connector) data source to:
    • Reuse a service and its resources.
    • Access any type of resource for a REST service defined in the app.
       
  • You should use a REST data source to:
    • Define and access a REST resource.
    • Access resources without user authentication or resources using Basic authentication.
    • Use a given resource from a service occasionally (resource not intended for reuse in another app).

List of properties

Content

Authentication Type: User authentication method for accessing the service.

  • None: No authentication required because the REST API is open or public.
  • Basic: Authentication is performed using Service Apps and communicated to the service via parameters in the URL.

Base URI: The URL for accessing data is made up of the service and the resource proposed by this service.

example  

Basic Authentication Parameters (Note: Only for Basic authentication): Login and password for accessing the resource. 

  • Click Edit icon.png to modify it.
  • To check that you have entered the login information correctly, you can tick the Show my password box.
             EVApps - datasource REST - Basic Parameters.png
Selector

Selector: Tool for extracting the data you want from the JSON file of the resource.

  • The JSON table contains a list of tags surrounding data subsets using curly brackets, { }.
  • You can click the tag you want in the JSON table (2).
    The tag will be highlighted in yellow.
    or
  • You can enter an expression in the search field at the top of the window (1) and click Apply  Open url.png See How to use regular expressions: JSONSelect website
             EVApps - datasource REST - Selector.png
End_Selector
SelectFirstRowAsCurrentRecord

Select First Row As Current Record: Used to indicate if the first record of the data source, when displayed in widgets, is selected by default (box is checked) or not (box is not checked).

NoDataMessage

No Data Message: This message is displayed when the data source does not contain any data.

  • Enter the code directly in the field or click Apps - Edit Html icon.png to open the text editor
AutoRefresh

Auto Refresh (Note: Only for dynamic data sources): Used to indicate the automatic refreshment interval for data from the data source in hours/minutes.

  • Data is automatically refreshed each time the app is run and each time the page is redisplayed, regardless of whether it is in execute mode or edit mode.

Caution: The updating of data requires additional activity on the Service Apps platform.

Best Practice icon.png  

  • You should define an automatic refreshment interval only if the app is required to constantly display real-time data for long periods of time on screen.

example  View dashboard data

  •  You should not specify an automatic refreshment interval if the app is only used for displaying a snapshot of data.

example  Display a portal where catalogs can be consulted

Master/Detail

SectionMasterDetail

Master Datasource: In a master-detail relationship, this is the name of the master data source linked to the current data source.

Master Field: Name of the primary key in the master data source used to establish the link with the current data source.

  • As a general rule, it is the PK (Primary Key) column in the Service Manager) table.

Detail Field: Name of the EasyVista data source column identifying the key in the Service Manager table.

  • As a general rule, it is the column whose prefix is FK (Foreign Key).

example  You want to display all actions (detail data source) associated with an incident (master data source):

  • Master Datasource = Incidents data source defined using the Operation > Incidents > All Incidents parent query.
  • Master Field = PK identifying the Incident_ID column in the Incidents table.
  • Detail Field = FK_AM_ACTION_REQUEST_ID identifying the action number related to the incident.

Procedure: How to create and use a REST data source

Step 1: Create the REST data source.

1. Click Apps - Add datasource icon.png Add Data Source in the Objects pane.

2. Select the data source type, Apps - Datasource - JSON Online icon.png REST (Online category).
 

Step 2: Define the properties of the new data source.

1. Specify the data source in the Base URI field.

2. Select the authentication method for accessing the resource.
The fields specific to the authentication method will appear.

  • (optional) Basic authentication method
    • Click Apps - Edit icon.png next to Basic Authentication Parameters.
    • Specify the login and password.

3. Select the data of the resource to be displayed.

  • Click Edit icon.png next to the Selector field.
    • The Selector tool window will appear. 
    • The contents of the resource will appear in a JSON table.
  • You can click the tag you want in the JSON table.
    The tag will be highlighted in yellow.
    or
  • You can enter an expression in the search field at the top of the window and click Apply.
             Apps - Connectors - Connectors tab - REST edit selector.png
  • Click OK.

4. Specify the other properties of the data source.
 

Step 3: Add the widget displaying data from the data source.

1. Click Apps - Add widget icon.png Add Widget in the Objects pane.

2. Select the type of widget you want.

3. Configure it to point to the REST data source you previously configured.

4. Specify the other properties.
 

Step 4: Test the app.

1. Select the type of device on which you must test the app.

  • Apps - GUI - Desktop view icon.png : Display on a PC
  • Apps - GUI - Mobile view icon.png: Display on a smartphone
     

2. Click EVApps - GUI - Execute icon.png to run the app.
The app will appear in a new web browser tab.

3. Check that the data from the resource is correctly displayed.

SAS_IntegrationRESTAboutTheUse

About the use of the software companies API REST

   Caution : The possible cost of the use of the third-parties API REST via Service Apps is not taken care by EasyVista.

  • Numerous software companies limit the access to the API REST of their software, generally by basing itself on a number of calls by hour/day/month.
  • Only specific editions of their software can be eligible in the use of the API REST (with or without additional cost).
  • Some software companies set up plans, e.g., Classic, Professional, Enterprise, for which the number of possible calls to the REST API or even to specific resources (i.e. endpoints) can be more or less numerous.

Examples of integration

Below is a list of the products interfacing with Service Apps using a REST (Connector) data source. See the procedure available in each page.

Tags:
Powered by XWiki © EasyVista 2022