2022
DBSync DBSync Swagger 2.0/ OpenAPI 3.0 0 or OpenAPI adapter facilitates the user to use any homegrown applications and integrate it with other applications by enabling the Swagger API on their systems.
...
We will be using Swagger Demo from from https://petstore.swagger.io and and use it to show how to integrate it using CloudWorkflow
...
Login into DBSync cloud workflow instance
To setup Connector follow the steps listed below:
Click on connectors from the left panel and add New Connection as follows:
Fig: Connector section
Provide a name for the connector and choose Swagger API Connector from the drop-down menu.
Click Save to move to the next step.
Under Connector Settings add respective values as mentioned below. In this example we are setting up process to ‘Get’ method by status by either using Swagger URL validation validation https://petstore.swagger.io/#/pet/findPetsByStatus or or add the query by using Swagger json query box.
Fig: Connector settings
Note: The Username, Password are auto filled fields based on login credentials, and make changes if required while validation.
During the setup process, there could be a need to have additional headers to authenticate the API calls. Our platform enables this customizable feature. In this example , an additional header would be be ‘Special-key’, this helps in providing authentication to access and make API calls to the Petstore. Json Json query for this would be as below:
"x-additional-headers": [
...
DBSync Swagger API supports the following methods listed below. For each of these methods workflow can be created :
Read Methods - this can be accessed in the Trigger section of the workflow.
Get Get - this method is used to read data from a list or individually. All Get calls show up under the Trigger section of the workflow.
Fig : 1.Trigger section in a Workflow 2. Select datasource 3. Select object
Write Methods - this can be accessed in the Rule section of the workflow.
Post Post - this method adds a new record in the target application. All post calls Show up under Rules section of the workflow and work on Insert command.
Put Put - deprecated operation can be performed using this method. All put methods methods Shows up Rules section of the workflow and work on Upsert command.
Patch Patch - All put methods methods are listed under the Rules section of the workflow and work on Update command.
Delete Delete - Deletion operations on API’s can be performed using this method. All delete methods methods are listed under the Rules section of the workflow and work on Delete command.
Fig Fig : 1.Rules section in a Workflow 2. Console Adapter 3. Select insert/upsert/update 4. Select console
Let us now create a workflow - ‘GetAllPets’ which has collated ‘Get’ queries under Processes.
Click the pencil icon to edit and query all the pets.
A trigger section will open up. This section basically lists all the Get the Get Calls.You You can see this as the first section upon clicking the edit button.
Get Get - All Get calls show up under the Trigger section of the workflow. The Get call is basically a Read data which will provide a list of data or individual records.
Fig:Selecting Swagger API from select datasource
Select the APIAPI (the connector that was created from the list in the Select the Select datasource section
Fig:Selecting Swagger API from select datasource
Select the Object from the list . For this example let us consider Find consider Find by Status.Refer image below.
You can also select by tags, store inventory, user etc.
...
Fig: How to select objects from Trigger section
Based on these conditions all the parameters are identified by the application and the Field, Operator and values columns are automatically filled.
Click Preview to validate.
Refer below image to verify validation. The query result will reflect as below if validated.
Fig - Query result post validation
Rules:The The rules sections lists all the supported methods of calls such as the below mentioned list:
The rules section is embedded with a console adapter and you can integrate the data by clicking console.
Fig: Rules Section
Click Map to create a mapping of the data
Fig: Mapping Screen
Select the schema from the drop-down
Click Save and Close
Click Save WorkFlowSave Workflow
A pop-up confirming the workflow is saved will appear on the screen
...
Fig: Pop-up confirming workflow is saved
Click Run Now
...
Fig: Integration complete
...
Follow the same steps to create a post call.
Click the edit icon to create a post call
Select the datasource as console adapter
Select the target object as console
Click Preview
...
Fig:Trigger Section in a Workflow
Under Rules section enter details as below:
...
Fig:Rules Section in a Workflow
Select target connector as the project you created(Petstore Swagger API)
Select operation: Insert, Update or upsert. For this example select Insert.
Select target object. For this eg select pet
Click Map.
...
Fig: Mapping
Click Save and Close
Click Save Workflow
Click Run Now
Fig: Integration complete
To get started Click this link to create an account -
https://www.mydbsync.com/product/cloud-workflow
Setup your connection using similar steps listed in this document.
Create customizable processes and workflow.
Use reference links below to create the same workflow.
Our Blogs
...
Swagger API documentation : https://swagger.io/docs/specification/paths-and-operations/
Swagger Tutorial : https://swagger.io/blog/api-design/openapi-3-0-specification-training/
PetStore : https://petstore.swagger.io/
Json formatter: https://jsonformatter.curiousconcept.com/#
PetStore swagger json: https://petstore.swagger.io/v2/swagger.json
...