2022

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview 

DBSync DBSync Swagger 2.0/ OpenAPI 3.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:

Image ModifiedImage Modified

                                                          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.  

Image Modified

                                                                Fig: Connector settings 

Note: The Username, Password  are auto filled fields based on login credentials, and make changes if required while validation.

Customizable Header Feature 

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.  

Image Modified

                          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.


Image Modified

Fig  Fig : 1.Rules section in a Workflow 2. Console Adapter 3. Select insert/upsert/update 4. Select console

Workflow to create ‘GetAll’

  • 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.



Image Added



         Fig:Selecting Swagger API from select datasource


  • Select the APIAPI (the connector that was created from the list in the Select the Select datasource sectionImage Removed

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.


Image Modified

...

                                     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.

Image Modified

                                    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. 

Image Modified

                                   Fig: Rules Section


  • Click Map to create a mapping of the data

Image Modified

                                  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



Image Modified

...

                               Fig: Pop-up confirming workflow is saved

  • Click Run Now

Image Modified

...

                             Fig:  Integration complete

  • A list of all the pets along with the json will be displayed.

Workflow to create a ‘Pet’

...

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

Image Modified

...

                                   Fig:Trigger Section in a Workflow

  • Under Rules section enter details as below:

Image Modified

...

                                 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. 

Image Modified

...

                                 Fig: Mapping

  • Click Save and Close

  • Click Save Workflow

  • Click Run Now

Image Modified

                              Fig: Integration complete

Steps to get started 

  1. To get started Click this link to create an account - 

https://www.mydbsync.com/product/cloud-workflow

  1. Setup your connection using similar steps listed in this document. 

  2. Create customizable processes and workflow.

  3. Use reference links below to create the same workflow.

Our Blogs 

https://www.mydbsync.com/blogs/swagger-examined-part-1-how-to-document-an-api-with-incredible-simplicity/

...

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  

...