FRENDS supports importing and editing Swagger Specifications. Swagger Specifications can be used to generate Processes that serves as API endpoints. Processes that belong to a Specification can be managed and deployed as a unit.

The API Management page can be found under "API". 

Importing a Swagger definition

FRENDS support importing Swagger 2.0 Specification in JSON format. YAML markup is not supported. If your Swagger Specification is in YAML, use for example the Online Swagger Editor to download a converted version. This tool can also be used for creating Swagger Specifications that can be imported into FRENDS. 

It's possible to modify an imported Swagger Specification using external tools. If you want to update an imported Swagger Specification, just import the updated specification and FRENDS will automatically create a new version of the Specification. Note that the one thing that can not change in between imports is the base path of the Specification - if the base path differ, a new API will be created rather than a new version of the old API. 

API Deployment and Version Control

API versions exists in two different states. The version that is seen in the Development environment is always the current Development version of an API. In all other environments, published versions are shown.

Development versions

A development version of an API is a version where the linked processes does not have locked down versions. That means that the user can update any process that is a part of the API without taking any additional actions. The development version can also have it's Swagger specification modified. When an API is ready for deployment, a Published version will be created. 

Published versions

A published version contains everything a development version does, but it no longer allows any changes. It locks down the process versions which is in use, and the Swagger Specification can no longer be changed. A published version can be deployed as a unit, and it can also be used to rollback the Development version to a previous point. 

Deploying

When deploying the user can choose to deploy a previously Published version, or create a new Published version from the current Development version. The Deployment dialog allows the user to see which processes will be deployed as well as the Swagger Specification. If a Published version is no longer valid, for example due to a used process being deleted, then it can no longer be Deployed.

Editing Swagger

FRENDS supports editing imported Swagger Specifications. The Base path of an Swagger Spec can not be changed once it has been imported. 

Note that editing a Swagger Specification will override the current Swagger Specification, it will not create a rollback point by default. If you want a rollback point before editing, press Deployment and choose "Save and deploy". This will create a new version of the Specification and allow you to roll back at a later stage. It's not mandatory to go trough with the Deploy step.

Creating API processes

Once a Swagger Specification has been imported, FRENDS can create Processes matching the API operations defined in the specification. 

A process generated from an API Specification will contain an API Trigger. The Trigger will give the process access to all expected variables passed to the endpoint, and will even cast them to the correct type. 

A generated process will also come with pre-generated responses. For example, if an endpoint is defined to return a Pet object on success and an Error object otherwise, then the process will contain both of these responses upon creation, complete will expected parameters (as long as Swagger Specification contains all required information, of course). Whatever happens in between the trigger and the responses is up to the user.

Note that some settings that are defined in the Swagger specification are set on a process level. Supported schemas as well as Authentication will be set by the API Trigger, and might differ from what has been defined in the Specification. 

Once Api is created the basepath cannot be edited, because all operation URIs are based on it. Version number can be added to basepath, if multiple versions are needed. The benefit of having e.g. different basepaths for v1 and v2 of the APIs is that then you can have both deployed in the same environment.

FRENDS will add "api" to the basepath upon save, e.g. example.com/api/foo/bar/v3, if it doesn't have it already. The /api prefix is because you can have simple HTTP triggers as well, the API triggers have their own reserved prefix, so there are no route conflicts, e.g. with HTTP trigger with route /foo/bar and API trigger /api/foo/bar

Unlinking a process

A process that has been created from an API Operation is linked to the API Specification that created it. That means the process will be deployed when the API is deployed, and the API Deployment will make sure the right version of that process is deployed. 

If you wish to unlink a process from an API, to example create a new process for that API Operation, simply click "Unlink Process". An unlinked process can easily be re-linked to an API.

On Swagger Operation changed

FRENDS detects when a Swagger Operation has changed for a Process with an API Trigger. This can happen when importing a new version of a Specification or when editing the Swagger Specification - for example an operation can gain an extra parameter, or there's a schema definition change.

FRENDS offer the functionality to update the Process' API trigger to match the new Swagger Specification. Note that this only updates the trigger- if the expected responses have changed, then it's up to the user to modify those. 

In case an operation is removed entirely, then the process gets unlinked from the Specification. API processes that are unlinked from an API are still visible in the view.

HTTP Response types

Responses are defined in a Swagger operation by HTTP status codes. For codes beginning with 2 or 3 (success / redirection), a Return element will be generated. For others, a Throw element will be generated. 

Note that the behavior of these two elements are different.

A Throw element will end the process in an error state, and if used in a Scope or a loop, it'll end the process execution without continuing. Throw will also cause Error handlers to trigger. 

A Return will end the process in a success state, and will continue executing if used in a Scope or loop.  

If you need to send out an error response but do not want the behavior that comes with a Throw element just add a Return element with the same settings as the Throw. 

Deleting API Specifications

Deleting from a non-Development environment only removes the deployed processes and the deployed API Specification - they will still exist in the Development environment and can be re-deployed from there. Deleting from the Development environment removes the API as well as the linked  processes. It's only possible to delete the API from the Development environment if it's not deployed in other environments. 

Swagger features not supported

  • Form parameters are not supported. 

  • File parameters are not supported.

  • Only parameters defined on an operation level will be available for auto-complete in the Process editor.

API Discovery

Active processes part of an API Specification can be found, explored and tested from the Agent API Discovery page. By navigating to https://<agent url>:<port>/api/docs/, a list of active specifications will be shown. By navigating to a Specification, each active operation can be explored and tested.

           

          

          

            

Did this answer your question?