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/Output | Type of View | Number of Views | Examples of Upstream and Downstream Snaps | Description |
---|---|---|---|---|
Input | Document |
|
| A document containing all the information required by the Snap. You can add the second input view to supply the OpenAPI specification. |
Output | Document |
|
|
|
Snap Settings
Parameter Name | Data Type | Description | Default Value | Example |
---|---|---|---|---|
Label | String | Required. 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. | OpenAPI | Read Employee List |
OpenAPI specification | String | 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:
Syntax for file path in SLDB:
| N/A | https://petstore3.swagger.io/api/v3/openapi.json sldb:///openapi.json openapi.json |
OpenAPI base URL | String/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/A | https://petstore3.swagger.io/api/v3 |
OpenAPI path | String | 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} |
Operation | String | 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/A | get |
Pass through | Checkbox | Select this checkbox to enable the snap to pass the input document to the output view under the key original . | Selected | Deselected |
Display headers for Get | Checkbox | Select 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. | Deselected | Selected |
Number of retries | Integer | Enter the maximum number of retry attempts in case of a failure in execution. | 0 | 3 |
Retry interval (seconds) | Integer | Specify the minimum number of seconds to wait before the next retry. | 1 | 3 |
Trust all certificates | Checkbox | 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. | Deselected | Selected |
Enable URL Encoding | Checkbox | Select this checkbox to automatically encode the URL of the request path. | Deselected | Selected |
HTTP Headers | Add HTTP header key-value pairs. This field set contains the following fields:
| |||
Headers | String | Specify the key name for HTTP Header. | N/A | filters |
Values | String | Specify the value for HTTP Header key. | N/A | firstname==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 | String | Enter the name of the Query Parameter | N/A | APIKey |
Values | String | Enter the value of the Query Parameter | N/A | 84rhsfdfy8vgioavgf |
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 | String | Select and specify additional parameters for the intended operations upon the endpoint. Available options are:
| N/A | Has next Next URL |
Values | String/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 |
|
Snap Execution | String | Select one of the three following modes in which the Snap executes:
| Validate & Execute | Execute 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.
Downloads
Important steps to successfully reuse Pipelines
- Download and import the pipeline into the SnapLogic application.
- Configure Snap accounts as applicable.
- Provide pipeline parameters as applicable.
Snap Pack History
See Also
- OpenAPI Specification 2.0
- OpenAPI Specification 3.0
- Getting Started with SnapLogic
- Snap Support for Ultra Pipelines
- Three Common Scenarios to Leverage the OpenAPI Specification
Have feedback? Email documentation@snaplogic.com | Ask a question in the SnapLogic Community
© 2017-2024 SnapLogic, Inc.