Hello, how can we help you?

Recent Searches: SCIM provisioning - Monitoring system synchronizations - LDAP - Scheduling data import from DIINTERFACE - Fixing import errors

REST data source usage examples

 

Prerequisite

  • Access to the Data source management > Data sources > REST (DI001) menu.

 

Introduction

This article presents examples of REST data sources.

The examples described in this section contain real data and can be applied to any SoftExpert Suite instance. Thus, by following them, it is possible to create and consume data from REST data sources. 

The data of the services used in the records is also available in this section.

 

Creating a service with OAuth Client Credentials authentication

1. Access the Data source management > Data sources > REST (DI001) menu.

2. Click on the button.

3. In the REST service data step of the wizard that will open, fill in the fields, as described in the table below:

ID # sesuiteSampleOAuthService
Name SoftExpert Suite OAuth Service Sample
Service URL https://​<my-domain>​/softexpert/rest/sample/oauth
Credential Authentication type: OAuth authentication (Client Credentials)
Token access URL: https://​<my-domain>​/softexpert/rest/sample/oauth/token
Client ID: idsample
Client Secret: somesecret

The portion of the URLs containing <my-domain> must be changed to the domain of the environment in which the source is being created.

 

4. Click on the Next button at the end of the configuration of each step.

5. In the Input parameters step, insert only the method as GET.

6. In the Output parameters step, insert the response body, as shown in the following example:

{
  "message": "string",
  "status": 0
}

7. Move past the Security step without setting any configurations in it.

8. In the Summary step, it is possible to check the configurations performed in the previous steps. Click on the Consumption test button to run a test for the added service. On the screen that will open, click on the Execute button.

9. Your data source is properly configured and working correctly! Click on the Finish button to complete the creation process.

 

Creating a service with GET method

1. Access the Data source management > Data sources > REST (DI001) menu.

2. Click on the button.

3. In the REST service data step of the wizard that will open, fill in the fields, as described in the table below:

ID # sesuiteSampleCompanyServiceQuery
Name SoftExpert Suite Company Service Query Sample
Service URL https://​<my-domain>​/softexpert/rest/sample/company

The portion of the URLs containing <my-domain> must be changed to the domain of the environment in which the source is being created.

 

4. Click on the Next button at the end of the configuration of each step.

5. In the Input parameters field, fill in the fields with the values below:

  • Method: GET
  • ID #:​ term
  • Parameter:​ QUERY
  • Type:​ STRING

6. In the Output parameters step, insert the response body, as shown in the following example:

[
  {
    "identifier": 0,
    "companyName": "string",
    "state": "string",
    "country": "string"
  }
]

7. Move past the Security step without setting any configurations in it.

8. In the Summary step, it is possible to check the configurations performed in the previous steps. Click on the Consumption test button to run a test for the added service. In the Search section of the screen that will open, set the following parameter:

  • term: canada

9. Click on the Execute button.

10. Your data source is properly configured and working correctly! Click on the Finish button to complete the creation process.

 

Creating a service with POST method

1. Access the Data source management > Data sources > REST (DI001) menu.

2. Click on the button.

3. In the REST service data step of the wizard that will open, fill in the fields, as described in the table below:

ID # sesuiteSampleCompanyServiceInsert
Name SoftExpert Suite Company Service Insert Sample
Service URL https://​<my-domain>​/softexpert/rest/sample/company

The portion of the URLs containing <my-domain> must be changed to the domain of the environment in which the source is being created.

 

4. Click on the Next button at the end of the configuration of each step.

5. In the Input parameters field, fill in the fields with the values below:

  • Method: POST
  • Request body:
{
  "companyName": "string",
  "state": "string",
  "country": "string"
}

6. In the Output parameters step, insert the response body, as shown in the following example:

[
  {
    "identifier": 0,
    "companyName": "string",
    "state": "string",
    "country": "string"
  }
]

7. Move past the Security step without setting any configurations in it.

8. In the Summary step, it is possible to check the configurations performed in the previous steps. Click on the Consumption test button to run a test for the added service. In the Request body section of the screen that will open, set the following parameters:

  • companyName:​ CT - COMPANY FOR TESTS
  • state: ​SHANDONG
  • country: ​CHINA

9. Click on the Execute button.

10. Your data source is properly configured and working correctly! Click on the Finish button to complete the creation process.

 

Example service data

The Company service simulates the manipulation of information on fictitious corporations' data and is available to be used in the REST data source. 

See the available endpoints below:

Retrieving all corporations

  • URL: https://​<my-domain>​/softexpert/rest/sample/company
  • Method: GET
  • Response body:
[
  {
    "identifier": 0,
    "companyName": "string",
    "state": "string",
    "country": "string"
  }
]

 

Filtering corporations

  • URL: https://​<my-domain>​/softexpert/rest/sample/company/query
  • Method: GET
  • Parameters (Query Params): NAME: term / TYPE: text
  • Response body:
[
  {
    "identifier": 0,
    "companyName": "string",
    "state": "string",
    "country": "string"
  }
]

 

Filtering corporations with a value range

  • URL: https://​<my-domain>​/softexpert/rest/sample/company/between
  • Method: GET
  • Parameters (Query Params)
    ◦ NAME: minID / TYPE: numeric
    ◦ NAME: maxID / TYPE: numeric
  • Response body:
[
  {
    "identifier": 0,
    "companyName": "string",
    "state": "string",
    "country": "string"
  }
]

 

Adding a new corporation

  • URL: https://​<my-domain>​/softexpert/rest/sample/company
  • Method: POST
  • Request body:
{
  "companyName": "string",
  "state": "string",
  "country": "string"
}
  • Response body:
{
  "identifier": 0,
  "companyName": "string",
  "state": "string",
  "country": "string"
}

The added corporation will not be actually persisted or saved in memory; it is simply an example simulating the insertion of a record.

 

 

Updating the corporation

  • URL: https://​<my-domain>​/softexpert/rest/sample/company
  • Method: PUT
  • Request body:
{
  "identifier": 0,
  "companyName": "string",
  "state": "string",
  "country": "string"
}
  • Response body:
{
  "identifier": 0,
  "companyName": "string",
  "state": "string",
  "country": "string"
}

The added corporation will not be actually updated; it is simply an example simulating the update of a record. If a valid ID # is not passed, nothing is returned.

 

 

Deleting the corporation

  • URL: https://​<my-domain>​/softexpert/rest/sample/company
  • Method: DELETE
  • Response body:
{
  "message": "string"
}

The added corporation will not be actually deleted; it is simply an example simulating the removal of a record.

 

The portion of the URLs containing <my-domain> must be changed to the domain of the environment in which the source is being created.

 

 

Conclusion

All done! Now you know an example referring to the creation of a data source with GET and POST methods and of services that can be consumed successfully.


Was this article helpful?