Discovering and Cataloging APIs with Swagger + Integration API

Even when a API management tool is not in place, VSM can support setting up an API catalog by extracting data from Swagger definition files.

📘

See API Catalog for more details.

The LeanIX Integration API provides a highly flexible way to map API data into the Data Model. The following Swagger example, sample processor and sample LDIF can be used to demonstrate how to get API data into VSM within minutes:

{
   "processors":[
      {
         "processorType":"inboundFactSheet",
         "processorName":"Sample_Swagger_Processor",
         "processorDescription":"Processor for Swagger Int",
         "type":"API",
         "filter":{
            "advanced":"${content.type == 'API'}"
         },
         "identifier":{
            "external":{
               "id":{
                  "expr":"${content.id}"
               },
               "type":{
                  "expr":"externalId"
               }
            }
         },
         "run":0,
         "updates":[
            {
               "key":{
                  "expr":"name"
               },
               "values":[
                  {
                     "expr":"${content.id}"
                  }
               ]
            }
         ],
         "enabled":true
      },
      {
         "processorType":"inboundRelation",
         "processorName":"[email protected]/Users/dominikrose/dev/leanix-cloud-beta/data/processors/ms/swagger (# '2')",
         "processorDescription":"[email protected]/Users/dominikrose/dev/leanix-cloud-beta/data/processors/ms/swagger (# '2')",
         "type":"relAPIToProviderMicroservice",
         "filter":{
            "advanced":"${content.type == 'API'}"
         },
         "from":{
            "external":{
               "id":{
                  "expr":"${content.id}"
               },
               "type":{
                  "expr":"externalId"
               }
            }
         },
         "to":{
            "external":{
               "id":{
                  "expr":"${data.microserviceId}"
               },
               "type":{
                  "expr":"microserviceId"
               }
            }
         },
         "run":1,
         "updates":[
            
         ],
         "enabled":true
      },
      {
         "processorType":"inboundDocument",
         "processorName":"[email protected]/Users/dominikrose/dev/leanix-cloud-beta/data/processors/ms/swagger (# '3')",
         "processorDescription":"[email protected]/Users/dominikrose/dev/leanix-cloud-beta/data/processors/ms/swagger (# '3')",
         "identifier":{
            "external":{
               "id":{
                  "expr":"${content.id}"
               },
               "type":{
                  "expr":"externalId"
               }
            }
         },
         "filter":{
            "exactType":"API"
         },
         "run":1,
         "updates":[
            {
               "key":{
                  "expr":"name"
               },
               "values":[
                  {
                     "expr":"${integration.valueOfForEach.name}"
                  }
               ]
            },
            {
               "key":{
                  "expr":"url"
               },
               "values":[
                  {
                     "expr":"${integration.valueOfForEach.url}"
                  }
               ]
            },
            {
               "key":{
                  "expr":"description"
               },
               "values":[
                  {
                     "expr":"${integration.valueOfForEach.description}"
                  }
               ]
            }
         ],
         "enabled":true,
         "forEach":"${data.operations}"
      }
   ],
   "credentials":{
      "useTechnicalUser":true
   },
   "dataProvider":{
      "url":"${header.customFields.url}",
      "type":"azureStorage"
   },
   "logLdifUrl":true
}
{
   "connectorType":"swagger-connector",
   "connectorId":"swagger-connector",
   "connectorVersion":"1.0",
   "lxVersion":"1.0.0",
   "lxWorkspace":"<WORKSPACE_ID>",
   "description":"",
   "processingDirection":"inbound",
   "processingMode":"full",
   "customFields":{
      
   },
   "content":[
      {
         "type":"API",
         "id":"https://petstore.swagger.io/v2 pet",
         "data":{
            "name":"Swagger Petstore - pet",
            "operations":[
               {
                  "url":"https://petstore.swagger.io/v2/pet",
                  "name":"POST - https://petstore.swagger.io/v2/pet",
                  "description":"Add a new pet to the store"
               },
               {
                  "url":"https://petstore.swagger.io/v2/pet/findByStatus",
                  "name":"GET - https://petstore.swagger.io/v2/pet/findByStatus",
                  "description":"Finds Pets by status"
               },
               {
                  "url":"https://petstore.swagger.io/v2/pet/findByTags",
                  "name":"GET - https://petstore.swagger.io/v2/pet/findByTags",
                  "description":"Finds Pets by tags"
               },
               {
                  "url":"https://petstore.swagger.io/v2/pet/petId",
                  "name":"GET - https://petstore.swagger.io/v2/pet/{petId}",
                  "description":"Find pet by ID"
               },
               {
                  "url":"https://petstore.swagger.io/v2/pet/petId/uploadImage",
                  "name":"POST - https://petstore.swagger.io/v2/pet/{petId}/uploadImage",
                  "description":"uploads an image"
               }
            ],
            "description":"Everything about your Pets",
            "microserviceId":"<MICROSERVICE_ID>"
         }
      },
      {
         "type":"API",
         "id":"https://petstore.swagger.io/v2 store",
         "data":{
            "name":"Swagger Petstore - store",
            "operations":[
               {
                  "url":"https://petstore.swagger.io/v2/store/inventory",
                  "name":"GET - https://petstore.swagger.io/v2/store/inventory",
                  "description":"Returns pet inventories by status"
               },
               {
                  "url":"https://petstore.swagger.io/v2/store/order",
                  "name":"POST - https://petstore.swagger.io/v2/store/order",
                  "description":"Place an order for a pet"
               },
               {
                  "url":"https://petstore.swagger.io/v2/store/order/orderId",
                  "name":"GET - https://petstore.swagger.io/v2/store/order/orderId",
                  "description":"Find purchase order by ID"
               }
            ],
            "description":"Access to Petstore orders",
            "microserviceId":"<MICROSERVICE_ID>"
         }
      },
      {
         "type":"API",
         "id":"https://petstore.swagger.io/v2 user",
         "data":{
            "name":"Swagger Petstore - user",
            "operations":[
               {
                  "url":"https://petstore.swagger.io/v2/user",
                  "name":"POST - https://petstore.swagger.io/v2/user",
                  "description":"Create user"
               },
               {
                  "url":"https://petstore.swagger.io/v2/user/createWithArray",
                  "name":"POST - https://petstore.swagger.io/v2/user/createWithArray",
                  "description":"Creates list of users with given input array"
               },
               {
                  "url":"https://petstore.swagger.io/v2/user/createWithList",
                  "name":"POST - https://petstore.swagger.io/v2/user/createWithList",
                  "description":"Creates list of users with given input array"
               },
               {
                  "url":"https://petstore.swagger.io/v2/user/login",
                  "name":"GET - https://petstore.swagger.io/v2/user/login",
                  "description":"Logs user into the system"
               },
               {
                  "url":"https://petstore.swagger.io/v2/user/logout",
                  "name":"GET - https://petstore.swagger.io/v2/user/logout",
                  "description":"Logs out current logged in user session"
               },
               {
                  "url":"https://petstore.swagger.io/v2/user/username",
                  "name":"GET - https://petstore.swagger.io/v2/user/username",
                  "description":"Get user by user name"
               }
            ],
            "description":"Operations about user",
            "microserviceId":"<MICROSERVICE_ID>"
         }
      }
   ]
}

Once the LDIF and processor files have been uploaded to the VSM workspace and then executed, you will see:

a) A list of connected Software Artifact and API Fact Sheets

b) The opportunity to use the Data Flow or Relation Explorer to navigate and export dependencies

c) With a couple of clicks, you will be able to create an API catalog which reflects all the data contained in your API factsheets in the Inventory

d) In every API catalog item you will find relevant details such as description, base URL, schema, whether the API is public or private, data objects, methods used by the API (GET, POST, PUT or DELETE), contact or responsible person for the API and else. The details being displayed are customisable


Did this page help you?