The REST broker, shipped with K2 blackpearl 4.7 and K2 Appit 1.4 and later, allows you to integrate K2 with REST-based services. There are several resources available to you for getting up-to-speed on what you need to use these services from K2.

Help File Resources

  • REST Service Broker: The documentation of the REST broker, including helpful video links for watching how to configure the service from Appit and K2 blackpearl.
  • REST Swagger File Reference Format: The schema of the Swagger file with examples, limitations, how to handle files in the response, and when to use a root object to contain the payload results from the service.

Review this file reference format topic carefully while planning your REST service integration to learn about potential limitations of the Swagger format that can impact the feasibility of this approach. An alternative (if the REST broker cannot be used to integrate with the service) is to write a custom broker to handle things like dynamic field names, field names with numbers, and OAuth 1.0-based services.

How do I obtain a Swagger file?

There are several ways to get a Swagger file for use with the REST broker.

If your company DOES NOT provide or own the REST API endpoints:
  • Recommended: Work with the REST API endpoint provider or vendor directly. Most services providing REST APIs also provide a Swagger file, and you can download it directly from them or request a Swagger file. Alternatively, you can check APIGurus who provide examples: https://apis.guru/browse-apis/
  • Alternate #1: Use RESTUnited.com to generate a Swagger file based on example responses. See http://help.k2.com/kb001758 for more information.
  • Alternate #2: Generate a Swagger file manually.
If your company DOES provide or own the REST API endpoints:
  • Recommended: Use the Swashbuckle library to add Swagger to your project. See http://help.k2.com/kb001869 for more information.
  • Alternate #1: Use RESTUnited.com to generate a Swagger file based on example responses. See http://help.k2.com/kb001758 for more information.
  • Alternate #2: Generate a Swagger file manually.

KB Resources

  • Integrating a REST-based Service with K2: http://help.k2.com/kb001757. From basic architecture to writing your own SmartWizards, this is the end-to-end article on the power of the REST broker in the K2 platform.
  • How To: Generate a Swagger Descriptor for REST-based Services using Swashbucklehttp://help.k2.com/kb001869. Learn how to add the Swashbuckle NuGet project to your API to generate Swagger. This is useful if you control the source code.
  • Generating a Swagger Descriptor for REST-based Services using RESTUnited.com: http://help.k2.com/kb001758. Use this to discover how to generate a Swagger file for your custom or well-known REST service. This is useful if you do NOT control the source code.
  • Using the REST Service Broker with Azure API Apps: http://help.k2.com/kb001781. Use this to learn how to create an Azure API app and call it using the REST broker.

Online Swagger Files

Linked to from other documentation and videos, you can use these Swagger descriptor files for testing purposes:

If you have a Swagger file that you need to upload and make available with a URL, such as when registering an instance of the REST broker in K2 Cloud, Azure Blob Storage is currently one of the only services that allow file-based URLs that do not automatically download.

Related Resources