OpenAPI

In this article

Overview

Use this Snap to call the OpenAPI endpoint associated with your application. You can perform operations, such as GET or PUT, upon the endpoint based on the endpoint's configuration to accomplish the following tasks:

  • Download and process the endpoint's OpenAPI specification.

  • Provide the input schema suggestions for a selected base path and operation.
  • Prepare and execute HTTP requests and process HTTP responses.


Prerequisites

  • A valid OpenAPI account with relevant permissions.
  • A valid OpenAPI specification.

Support for Ultra Pipelines


Works in Ultra Pipelines

Limitations

None.

Known Issues

None.

Snap Input and Output

Input/OutputType of ViewNumber of ViewsExamples of Upstream and Downstream SnapsDescription
Input 

Document

  • Min: 0
  • Max: 2
  • Mapper
  • JSON Parser
A document containing all the information required by the Snap. You can add the second input view to supply the OpenAPI specification.
Output

Document

  • Min: 0
  • Max: 2
  • JSON Formatter + File Writer
  • Mapper
  • The HTTP response for the specified operation in the first output view. 
  • Parts and referred objects of the specification related to the selected path and operation in the second output view.

Snap Settings

Parameter NameData TypeDescriptionDefault ValueExample 
LabelStringRequired. The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your Pipeline.OpenAPIRead Employee List
OpenAPI specificationString

Enter the URL for the OpenAPI specification JSON or YAML file. Alternatively, upload the OpenAPI specification file to the SLDB by clicking the  button. 

Supported file protocols are:

  • http://
  • https://
  • sldb:///

Syntax for file path in SLDB:

  • Same project as the Pipeline:
    sldb://<filename>.json
    sldb://<filename>.yaml

    <filename>.json
  • Different project:
    sldb://<project_space>/<project>/<filename>.json
    sldb://Docmentation/OpenAPI/openapi.json

    This Snap supports external files referenced in this field and gets the data from the referenced files upon connecting to the file location. For example, $ref: 'reference to definition'

N/A

https://petstore3.swagger.io/api/v3/openapi.json

sldb:///openapi.json

openapi.json

OpenAPI base URLString/Suggestion

Required. Enter the OpenAPI base URL for the HTTP request. The Snap appends the base URL with the OpenAPI path field's value to form the full URL.

Alternatively, click the icon to select the OpenAPI base URL for the HTTP request. The Snap suggests the Base URL associated with the OpenAPI specification. We recommend you to refer to the target OpenAPI server documentation for the accuracy of the suggestion.

N/Ahttps://petstore3.swagger.io/api/v3
OpenAPI pathString

Required. Enter the path defined for the given OpenAPI URL. Alternatively, click the  to retrieve a list of available paths based on the value in the OpenAPI specification field. However, Snap suggestions work only when the OpenAPI specification field's value is not a Pipeline/upstream parameter.

N/A/pet/{petId}
OperationString
Required. Specify the HTTP method to run on the endpoint. Alternatively, click the  to retrieve a list of available operations based on the value in the OpenAPI specification field. However, Snap suggestions work only when the OpenAPI specification field's value is not a Pipeline/upstream parameter.
N/Aget
Pass throughCheckboxSelect this checkbox to enable the snap to pass the input document to the output view under the key original.SelectedDeselected
Display headers for GetCheckboxSelect this checkbox to display headers data for the Get request similar to Post requests, else the Snap displays all the entities directly in the output.DeselectedSelected
Number of retriesInteger

Enter the maximum number of retry attempts in case of a failure in execution.

03
Retry interval (seconds)Integer

Specify the minimum number of seconds to wait before the next retry.

13
Trust all certificatesCheckbox

Select this checkbox to trust all certificates, such as self-signed certificates. Deselect this checkbox when there is a third-party signed certificate to be separately authenticated.

DeselectedSelected
Enable URL EncodingCheckboxSelect this checkbox to automatically encode the URL of the request path.DeselectedSelected
HTTP Headers

Add HTTP header key-value pairs. This field set contains the following fields:

  • Headers
  • Values

Headers

String

Specify the key name for HTTP Header.

N/A

filters

ValuesStringSpecify the value for HTTP Header key.N/Afirstname==johnny
Query Parameters

Add query parameters to the request URL. These parameters are appended to the HTTP request URL.

Query parameters defined here will not be used if those parameters are defined as part of the OpenAPI specification.

This field set contains the following fields:

  • Parameters
  • Values
ParametersStringEnter the name of the Query ParameterN/AAPIKey
ValuesString Enter the value of the Query ParameterN/A84rhsfdfy8vgioavgf
Advanced properties

Use this field set to specify additional parameters for the intended operation. Most of these parameters control how you display the output, for example, Pagination interval (seconds) and Maximum pages. Specify each parameter as a separate row. Click  to add a new row.

This field set consists of the following fields:

  • Properties
  • Values
PropertiesString

Select and specify additional parameters for the intended operations upon the endpoint. 

Available options are:

  • Has next. Enter an expression that is evaluated with the output document to true or false indicating whether the Snap must get the next page. Depending on the server implementation, the hasNext information is contained in the response headers or entity. The value of this parameter must be expression-enabled. The Snap stops the pagination when this parameter is evaluated to false or the number of pages reaches the Maximum pages parameter value.
  • Next URL. Enter an expression that is evaluated with the output document to a URL that the Snap uses to get the next page. Depending on the server implementation, the next page URL information is contained in the response headers or entity. The value of this parameter must be expression-enabled.
  • Pagination interval (seconds). The number of seconds for the Snap to wait before attempting to get to the next page.
  • Maximum pages. The maximum number of pages to download. Use -1 is for unlimited pagination.
  • Enable process array. If the schema of the response entity is expected to be an array as specified in the endpoint’s OpenAPI specification, the Snap parses the array and writes a stream of output documents to the output view without other HTTP response data such as status line or headers. You can also disable this Snap behavior by entering false for this parameter.
  • Multipart file content key. The key name used for the file content in the input data and the multipart form-data.
  • Multipart filename key. The key name used for the filename in the input data and the multipart form-data.
N/A

Has next

Next URL

ValuesString/Integer

Enter the values to use for the additional parameters that you specify above.

Even if you do not specify any values for the above parameters, the Snap will use the default values at runtime. 



Has next. None

Next URL. None

Pagination interval. None

Maximum pages. -1 (for unlimited pagination)

Enable process array. true

Multipart file content key. file

Multipart filename key. name

  • Has next.
    $entity.['has-more']
    $entity.nextPageToken != null
  • Next URL.
    https://petstore3.swagger.io/api/v3/pet/findByStatus?status=sold&offset=" + $entity.offset 
  • Pagination interval. 3
  • Maximum pages.
    10, -1
  • Enable process array. false
  • Multipart file content key. uploadFile
  • Multipart filename key. filename
Snap ExecutionString

Select one of the three following modes in which the Snap executes:

  • Validate & Execute. Performs limited execution of the Snap and generates a data preview during Pipeline validation, then performs full execution of the Snap (unlimited records) during Pipeline runtime.
  • Execute only. Performs full execution of the Snap during Pipeline execution without generating preview data.
  • Disabled. Disables the Snap and all Snaps downstream from it.

Validate & ExecuteExecute only

Troubleshooting

None.

Examples

Fetching Pet Information by Status

We want to retrieve a list of all the available pets in the pet store. This Pipeline demonstrates how we can use the OpenAPI Snap to accomplish this task:

We must query the status parameter with the available value to view a list of all pets with the available status. We pass this value to the $parameters.query.status parameter in the OpenAPI specification using a Mapper Snap configured as shown below:

Based on the above configuration the Mapper Snap maps the value available to the $parameters.query.status parameter as shown in the Mapper Snap's output below: 

We configure the OpenAPI Snap to call the pet store's API using the OpenAPI specification, base URL, OpenAPI path, and operation type as shown below:

Upon successful execution, the OpenAPI Snap retrieves the information from the endpoint as shown in the Snap's output preview below:

This is how we can retrieve information based on specified parameters using the OpenAPI Snap. Additionally, we can add a JSON Formatter and File Writer downstream of the OpenAPI Snap to write the above output into a local file.

Download this Pipeline.

Downloads

Important steps to successfully reuse Pipelines

  1. Download and import the Pipeline into SnapLogic.
  2. Configure Snap accounts as applicable.
  3. Provide Pipeline parameters as applicable.

  File Modified

File OpenAPI_Example.slp

Nov 30, 2020 by Mohammed Iqbal

Snap Pack History

 Click here to expand...

Release

Snap Pack Version 

Date

Type

Updates

February 2024436patches25753 Latest

Fixed an issue with the OpenAPI Snap where the upstream Mapper Snap did not show the full schema objects in the Target Schema.

February 2024main25112 StableUpdated and certified against the current SnapLogic Platform release.
November 2023main23721 StableUpdated and certified against the current SnapLogic Platform release.

August 2023

main22460

 

Stable

Updated and certified against the current SnapLogic Platform release.

May 2023main21015 StableUpgraded with the latest SnapLogic Platform release.
February 2023

432patches20357

 Latest

The OpenAPI Snaps now support reference components with . in the name of the component.

February 2023main19844 StableUpgraded with the latest SnapLogic Platform release.
November 2022431patches19012 LatestPagination in the OpenAPI Snap was fixed for any OpenAPI GET operation with limit and offset values in query parameters.
November 2022main18944 StableUpgraded with the latest SnapLogic Platform release.
August 2022main17386 Stable

The OpenAPI Snap supports external files referenced in the OpenAPI specification field and includes the following new fields:

  • The Pass through checkbox allows you to pass input data to the output under original key.

  • Trust all certificates checkbox that allows you to use self-signed certificates.

  • Enable URL Encoding checkbox that allows automatic URL encoding of the request path.

4.29 Patch429patches16939 Latest
  • Enhanced the OpenAPI Snap with the following:

    • Pass through checkbox that allows you to pass input data to the output under Original key.

    • Trust all certificates checkbox that allows you to use self-signed certificates.

    • Enable URL Encoding checkbox that allows automatic URL encoding of the request path.

    • Support for external files referenced in the OpenAPI specification field.

4.29main15993 Stable
  • Enhanced the Base URL field in the OpenAPI Snap to support suggestions associated with OpenAPI Specifications.

  • Added Dynamic OAuth2 account that enables OAuth authentication for OpenAPI Snap.

4.28main14627 StableUpgraded with the latest SnapLogic Platform release.
4.27main12989StableFixed an issue in the OpenAPI OAuth2 account that caused a new feature, OAuth Password Grant Type to be excluded from the GA version. The latest deployed build includes this feature.

4.27

main12833

 

Stable

Enhanced OpenAPI OAuth2 accounts with a new option password for Grant Type to obtain an access token through user credentials. On selecting password, the Snap populates the Username and Password fields to enter the credentials.
4.26main11181 
StableUpgraded with the latest SnapLogic Platform release.
4.25 Patch425patches10417 Latest

Enhanced the OpenAPI Snap by adding the following two settings:

  • HTTP Headers
  • Query Parameters
4.25 Patch425patches9684 Latest

Adds Send Client Credentials as Basic Auth Header checkbox in the Create Account settings. You can select this checkbox when you want to send the client information as a header to the OAuth endpoint.

4.25main9554 StableNo updates made.
4.24main8556 Stable

No updates made.

4.23-Patches

423patches7812

 
  • Stable
  • Latest

Introduces the OpenAPI Snap Pack to enable you to connect to your OpenAPI endpoints. This Snap Pack supports OpenAPI Specification versions 2.0 and 3.0.


See Also