Configuration of REST Action Types
Service Manager can call the REST APIs of third-party apps to access external data.
- The third-party Web services must be declared in Service Manager and the associated services, connections and resources must be defined.
See the description
- The third-party Web services are then called in Service Manager in process steps, i.e. workflows and business rule-related processes via REST action types.
Services, connections and resources
Description
Service
A service identifies the third-party product that authorizes access to certain data via its REST API.
- Each service is reached via a URI that uses the REST (Representational State Transfer) HTTP protocol.
- The data of the service can be public and accessible to everyone or restricted to certain users (authentication required).
See Authentication methods
Connection
A connection establishes access to a given service once you have entered the required credentials for accessing the REST API, e.g. login and password, access token, app ID and client secret, etc.
Resource
A resource identifies an object in a given service which can be manipulated via the REST API.
- Each service may propose several resources, each accessible via a URI.
- You can perform different operations on the resource using REST methods, e.g. GET (read data), POST (write data), PUT / PATCH (update data) and DELETE (delete data).
- Data read in the resource is sent to Service Manager in JSON format, a structured text data format. A Selector tool enables you to extract only the data you want.
- Data is dynamic. It is automatically refreshed each time the data source is updated.
Examples
- Create an Employee form in Service Manager ==> Call the EasyVista service to use the Service Manager REST API:
- Service URL: https://{hostname}/api/v1/{account}/
- Create a connection to specify the variables in the settings: {hostname} and {account}
- Resource URI: employees
- Method: POST
Click to see the body of the request
"employees": [
{
"last_name": "{lastName_value}",
"phone_number": "{telephone_value}"
}
]
}
- Create a card (task to do) in Trello ==> Call the
Trello service to use the Trello REST API:
- Service URL: https://api.trello.com/1/&key={application_id}&token={auth_token}
- Create a connection to specify the variables in the settings: {application_id} and {auth_token}
- Resource URI: cards
- Method: POST
Click to see the body of the request
"idList": "{idlist}",
"name": "{name}"
}
Authentication methods supported by Service Manager
Authentication method | Characteristics | |
---|---|---|
None |
|
|
AWS (Amazon Web Service) |
|
|
Basic |
|
|
Bearer Token |
|
|
Bearer Token (Access Key) |
|
|
OAuth2 (custom) |
|
|
Self Help |
|
|
Service Manager (Access Token) |
|
|
ServiceNav |
|
Notes
- Services:
- The authentication method depends on the API set up by each third-party product and is described in the documentation of the API.
- A list of services is provided by EasyVista with the Service Manager setup.
- They cannot be modified.
- You can add other services manually.
- The service URI can contain:
- Parameters: These must be found at the end of the URL and each one must be prefixed by &.
- Variables or variable parameters: These must be surrounded by curly brackets { }. The values must be specified in the corresponding connection.
example
- XWiki service URI
: https://{subdomain}/xwiki/rest
- Trello service URI
: https://api.trello.com/1/&key={application_id}&token={auth_token}
- XWiki service URI
- Connections:
- A list of authentication methods is provided by EasyVista with the Service Manager setup. You cannot add new ones.
- Resources:
- A list of resources for each service is provided by EasyVista.
- They cannot be modified.
- You can add other resources manually by defining a URI.
See the REST API documentation of the resource.
- To find out more about the JSON table structure, please consult http://www.json.org.
- A list of resources for each service is provided by EasyVista.
Caution
- Bearer authentication method for the Service Manager REST API
- You must create an access token using the Access Tokens menu.
- You must specify None for the authentication method and enter the value of the access token.
- AWS (Amazon Web Service) authentication method
- Check that your PHP configuration uses the CACert certificate of your system in line with your organization's policy.
- You must specify the location of the certificate to ensure that PHP flows will be correctly initiated in HTTPS.
- AWS resources are system resources identified by their label. You must not modify this label.
Best Practice
- Delete the services that you are not using among those provided by EasyVista. This ensures that the palette of action types in the process graphic editor will only display those that you are using.
- To export a workflow containing REST steps, use the REST filter. This filter automatically displays all of the required REST objects for exporting workflows with REST steps, i.e. services, connections, resources. Note : The REST objects used by the workflow must be exported simultaneously for the initial export. Then only the modified REST objects should be selected with the workflow.
- For accessing the Service Manager REST API, we recommend that you use the authentication method Service Manager (Access Token) with a higher level of security than the Basic method which uses a login and password.
See the procedure
Screens description
Services
Menu access: Administration > REST > Services
Name: Name identifying the third-party product.
Authentication Method: Authentication method used for accessing the REST API of the service.
- The method depends on each REST API.
Service URL: Link for accessing the service.
- You can add variables in the main section of the URL using the following format: {variableName}. You can also add parameters at the end of the URL prefixed by the ? or & character.
example https://{hostname}/api/v1/{account}/
Icon: Image associated with the service so that users can identify it quickly among the workflow steps.
- Click Change to select the file you want.
- The supported file formats are jpg, png and gif.
AWS (Amazon Web Service) authentication method
API ID: Login.
Secret Key: Secret key.
Region: AWS region.
Bearer Token authentication method
Access Token Endpoint: URL of the token to be retrieved.
Method for accessing the token: HTTP request method used by the service, i.e. GET or POST.
- By default, the POST method is applied.
Scopes: Scopes of the authorized resources.
Bearer token property name: Name of the property.
API ID Property Name: Name of the property.
API ID: Login.
Secret Key Property Name: Name of the property.
Secret Key: Secret key.
Token Method: Default, Basic or URI.
Body Param Type: Default, form-data or form-urlencoded.
Grant Type: Default, Client_ credentials or password.
- The password option is used to enable authorization using a user login and password. If selected, the Username and Password fields will appear.
Private Key: Private key that was downloaded.
OAuth2 (custom) authentication method
Authorization Endpoint: URL called by Service Manager that will return a login page for manual authentication.
- Note: Mandatory if the third-party service has implemented this functionality.
Access Token Endpoint: URL of the token to be retrieved.
Scopes: This is generally a table that stores different authorization levels.
API ID: Login.
Secret Key: Secret key.
Callback URL: Server used for redirecting to the Service Manager Web line that will perform the REST call using OAuth authentication.
Token Method: Default, Basic or URI.
Body Param Type: Default or form-data.
Grant Type: Default or Client_ credentials.
Self Help authentication method
API ID: ID of the Self Help API key.
Secret Key: Secret of the API key.
Private Key: Private key downloaded from Self Help.
Service URL: https://{hostname}/selfhelp/api.
Service Manager (Access Token) authentication method
Bearer Token: Token to access the Service Manager REST API.
Service URL: URL for accessing the Service Manager REST API.
ServiceNav authentication method
Access Token Endpoint: URL of the token to be retrieved.
API ID Property Name: Name of the property.
API ID: Login.
Secret Key Property Name: Name of the property.
Secret Key: Secret key.
Token Method: Default, Basic or URI.
Body Param Type: Default, form-data or form-urlencoded.
Grant Type: Client_credentials.
Private Key: Private key that was downloaded.
Service URL: https://{hostname}/servicenav/{languages}.
Connections
Menu access: Administration > REST > Connections
Connection Name: Name identifying the connection.
Authentication Method: Authentication method used for accessing the REST API of the service.
Name: Name of the service for the connection.
- Only services corresponding to the selected authentication method will be available.
Service URL: Link for accessing the service.
- The URL is automatically defined when the service is selected.
- If URL contains variables, the fields related to these variables will appear and will be mandatory.
example
- Information required for accessing the EasyVista service
- Information required for accessing the AgileCRM service
- Information required for accessing the EasyVista service
Additional information required based on the authentication method and service
Username / User password: Login and password required for accessing the service called by the connection.
ACCOUNT / subdomain: Account and domain name provided by the service.
Key / Value: Used to customize the HTTP header of requests run by a third-party REST API, by passing a password, token or static API key, etc.
example Key = Authorization; Value = {Your Authorization Token}
Authentication parameters (Note: Only for OAuth2 (custom) authentication)
Resources
Menu access: Administration > REST > Resources
Label: Name identifying the resource.
Name: Name of the service for the resource.
Connection Name: List of connections available for the service.
Resource URI: Unique ID of the resource. The URI is automatically added to the service URL.
Method: Different operations that can be performed on the object using REST methods, e.g. GET (read data), POST (write data), PUT / PATCH (update data) and DELETE (delete data).
- If the resource authorizes users to select data, the Selector field will automatically appear. Click
to access the tool.
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
See How to use regular expressions: JSONSelect website
Contents: Body of the request containing the data to be updated.
- You should specify the settings in curly brackets { } when creating the corresponding REST step in the workflow.
- By default, the value of the field is sent to the REST API in text format. To force a numerical value, you must define the data type in the field as Double, Float, Int or Numeric.
Instruction | Value returned | Example | ||
---|---|---|---|---|
Note: Default option {"Price": "{Price}"} |
|
Returns 1 500.34 in French or 1,500.34 in English. | ||
{"Price": "{Price:double}"} {"Price": "{Price:float}"} {"Price": "{Price:numeric}"} |
|
Returns 1500.34 irrespective of the language. | ||
{"Price": "{Price:int}"} |
|
Returns 1500 irrespective of the language. |
Description: Description of the operation performed on the resource.
Procedures and Wizards
How to associate a new resource with a REST action type
Step 1: Create a service that is not provided by EasyVista
Note: Only if there is no existing service (third-party product).
1. Select Administration > REST > Services in the menu.
2. Click .
3. Complete the information required.
- In the service URL, enter the variable names surrounded by curly brackets { }.
- If you want to associate an icon with the service, click Change.
4. Click Save.
Step 2: Create a new connection for the service
Note: Only if there is no existing connection associated with the service.
1. Select Administration > REST > Connections in the menu.
2. Click .
3. Select the service.
4. Specify the additional information required.
5. Click Save.
Step 3: Create the resource associated with the connection
1. Select Administration > REST > Resources in the menu.
2. Click .
3. Select the service followed by the connection.
4. Enter the additional information for the resource.
The resource URI will automatically be added to the service URL.
- Resource using the GET method: You can narrow down the data using the Selector tool.
- Click
next to the Selector field.
- You can select the tag you want in the JSON table.
It will appear in yellow.
or
You can also enter an expression in the search field and click Filter. - Click Save.
- Click
- For the other methods: Specify the body of the request in the Content field.
See the examples
5. Click Save.
The new resource will appear in the list of action types in the process graphic editor.
Step 4: Add the new resource to a process step using a REST action type
1. Open the workflow or the business rule-related process you want.
- Workflow: References > Other References > Workflows (Operation/Transition)
- Business rule: Administration > Business Rules > Related Processes
2. Click V next to the REST Actions category.
3. Click and drag the new resource to the process graphic editor.
4. Double-click the outline of the step to specify its properties.
5. Click Confirm changes.
How to manage the result of a Service Manager REST action within a process
Workflows and business rule-related processes can contain REST actions.
- All Service Manager REST API methods can be called.
- You can manage the result of the REST action, i.e. Success or Error, using internal update steps.
example Manage the results when calling the Create an employee method
Step 1: Select the process
1. Open the process where you want to add the action.
- Workflow: References > Other References > Workflows (Operation/Transition)
- Business rule: Administration > Business Rules > Related Processes
Step 2: Create the step used to call a Service Manager REST API resource
1. Click and drag the EasyVista action type from the palette of action types (REST Actions category) to the graphic editor.
2. Double-click the outline of the step to specify its properties.
- Select the resource used to identify the Service Manager REST API method.
See the list of methods
- Specify the parameters used by the method. Note: The parameters are defined in the method.
Step 3: Create the step for the exit value, Success
1. Click and drag the Internal Update Step action type from the palette of action types (Automatic Actions category) to the graphic editor.
2. Double-click the outline of the step to specify its properties. See Graphic editor > Description of a step.
- Enter the SQL script used to update the Service Manager database.
example Update the Description field using the result returned by the REST call
Note: You can use another field to store the result. - Define the entry condition.
- Select the step linked to the Service Manager REST action you created earlier.
- Select the exit value, True, to indicate that the update is successful.
Step 4: Create the step for the exit value, Error
1. Click and drag the Internal Update Step action type from the palette of action types (Automatic Actions category) to the graphic editor.
2. Double-click the outline of the step to specify its properties.
- Enter the SQL script used to update the Service Manager database.
- Define the entry condition.
- Select the step linked to the Service Manager REST action you created earlier.
- Select the exit value, False, to indicate that the update failed.
Step 5: Test the process
ManageServiceManagerRESTAPIInProcess_Result
example Create an employee
Result returned if the update is successful
{"HREF":"https://{your_server}/api/v1/{your_account}/employees/18445"}
Result returned if the update failed
REST step workflow failed, HTTP error code returned by the service [HTTPCODE:401] (2114) "Error http4xx"x"
EndManageServiceManagerRESTAPIInProcess_Result
How to define access authorization to the Service Manager REST API
AccessRESTAPI
- Via Token authentication dedicated to the Service Manager REST API (authentication method Service Manager (Access Token)) using an access token.
See the procedure
- Via Basic authentication using a login and password.
See the procedure