The Gelato Import API is currently in Beta. Please let us know your feedback!
You can use this API to import a Swagger / Open API reference into Gelato programmatically. This is useful if you want to update your API documentation each time your CI build passes, or in a Git
There is a single resource in the API at the moment, the Imports resource.
First, be sure that you have a Swagger definition available publicly on the internet somewhere (this could be via S3, GitHub, or something similar).
You'll then make a
POST request to the
/v1/imports/ endpoint with a number of query parameters. Include the
import_type you're looking for (
swagger), and a
file_location which points to your publicly available file. You'll also need to include your
apikey and the
api_id of the Gelato API you'd like to import to (you can find this on the APIs & Docs tab in your Gelato Admin panel). The ids can be accessed by either clicking the Edit button for an API or for an API Version (see screenshots below).
Once you have your API id (required) and API version id (optional), you can construct a
curl request similar to this:
curl -X POST https://api.gelato.io/v1/imports?apikey=SOMEKEY&file_location=https://yourhost.com/file.yml&api_id=123&import_type=swagger
NOTE: If you do not include the optional
api_version_id query parameter in your request, you will need to specify the
basePath attribute in your Open API / Swagger reference before import, which you can read more about here.
If everything goes correctly, you'll receive a response that includes a URL pointing to your brand new import. You can use this to check the status of the import in progress as follows:
Remember to add your API key to the query parameters!
If you have any issues, please get in touch at firstname.lastname@example.org. Thanks!