Introduction
This Web UI wrapper was originally created around a collection of Node.js scripts to make more compelling demos of the Platform API (even though the likely use of the API will be via command-line.) However this has become a full tool set that enables customers to take advantage of their existing API definitions to onboard quickly to TIBCO Mashery.
This Web app is implemented using the Express and Handlebars frameworks, and leverages a client library for the Mashery Platform API created by Cox Automotive . The Web UI was designed to be extended using a simple configuration, hoping to encourage additional contribution and a growing set of API-driven tools.
This
Prerequisites
Node.js v4.4.3 or later
Installation
To use, clone the github repository into a new directory. Post clone of repository, change into the apidefinitionconverter directory and perform the following commands/steps:
npm install
cp credentials.js.sample credentials.js
and update to reflect your Mashery area information and V3 API key information.
Usage
From within the apidefinitionconverter directory, run following command:
node bin/www
Navigate to http://localhost:3000
Note: Target domains must be whitelisted before any of these tools are used, or the endpoint creation will fail.
The Tools
API Key Notification
This tool listens to Mashery Event Triggers (after key create/update/delete) and sends a text message to the key owner and an administrator about the key status. The UI allows the user to manually send an SMS notification to the owner of an API key about the key?s status.
Note: The demo uses the Twilio Programmable SMS API and the Pusher API. A Twilio account is required (a trial account is sufficient) as is a Pusher account and application (all configured in the .env configuration file.)
![keylist.thumb.png.fbf1e5d242bdf34618019e9c552c2feb.png](http://content.invisioncic.com/s329579/monthly_2024_01/keylist.thumb.png.fbf1e5d242bdf34618019e9c552c2feb.png)
![keynotify.thumb.png.273b282aed5b1d51d04d7ff4113b7e97.png](http://content.invisioncic.com/s329579/monthly_2024_01/keynotify.thumb.png.273b282aed5b1d51d04d7ff4113b7e97.png)
Copy API
This tool allows the user to copy an API definition from a source area to a destination area.
Note: The Copy API tool only copies API definitions. It does not copy packages and plans that reference the source API. The logic behind the decision to exclude them was that packages and plans, which are typically created and managed by business people, would be different across areas, whether the areas are used to separate dev/test from prod or different lines of business under the same company. Adding an option to include packages and plans (response filters, too?) is something we can look into in the future.
![copyapi_0.thumb.png.0099534b0cce107b4d8b98e83886b878.png](http://content.invisioncic.com/s329579/monthly_2024_01/copyapi_0.thumb.png.0099534b0cce107b4d8b98e83886b878.png)
RAML2Mashery
This tool consumes a RAML-based API definition (RAML 0.8 and 1.0 are supported) and creates a Mashery service definition in the target area. The RAML definition can be specified as a remote URL or loaded from a file system. The tool can be run in preview mode before being executed against a specific area.
![raml2masheryurl.thumb.png.45c30e9762036f511f02667871572ea6.png](http://content.invisioncic.com/s329579/monthly_2024_01/raml2masheryurl.thumb.png.45c30e9762036f511f02667871572ea6.png)
![raml2masheryfile.thumb.png.bdf1aa685f38ca24fcfd30213a673379.png](http://content.invisioncic.com/s329579/monthly_2024_01/raml2masheryfile.thumb.png.bdf1aa685f38ca24fcfd30213a673379.png)
Swagger2Mashery
This tool consumes a Swagger-based API definition (Swagger 1.2 and 2.0 are supported) and creates a Mashery service definition in the target area. The Swagger definition can be specified as a remote URL or loaded from a file system. The tool can be run in preview mode before being executed against a specific area.
![swagger2masheryurl.thumb.png.35b7dbeb75537965f91f46a5b213d554.png](http://content.invisioncic.com/s329579/monthly_2024_01/swagger2masheryurl.thumb.png.35b7dbeb75537965f91f46a5b213d554.png)
![swagger2masheryfile.thumb.png.bed2ad444ec7450d9298878abaf0b755.png](http://content.invisioncic.com/s329579/monthly_2024_01/swagger2masheryfile.thumb.png.bed2ad444ec7450d9298878abaf0b755.png)
WADL2Mashery
This tool consumes a WADL-based API definition and creates a Mashery service definition in the target area. WADL resources that share a common path can optionally be merged into a single Mashery endpoint. The tool can be run in preview mode before being executed against a specific area.
![wadl2masheryurl.thumb.png.5817cd867fcd93cfb9e2e9e2243203c2.png](http://content.invisioncic.com/s329579/monthly_2024_01/wadl2masheryurl.thumb.png.5817cd867fcd93cfb9e2e9e2243203c2.png)
![wadl2masheryfile.thumb.png.fe9a3ca5b648d3293e2da0af4cf90aa2.png](http://content.invisioncic.com/s329579/monthly_2024_01/wadl2masheryfile.thumb.png.fe9a3ca5b648d3293e2da0af4cf90aa2.png)
WSDL2Mashery
This tool consumes a WSDL-based SOAP Web service definition and creates a Mashery service definition in the target area. The WSDL definition can be specified as a remote URL or loaded from a file system. The tool can be run in preview mode before being executed against a specific area.
![wsdl2masheryurl.thumb.png.acc4ea4925368d559d746389099f1ca7.png](http://content.invisioncic.com/s329579/monthly_2024_01/wsdl2masheryurl.thumb.png.acc4ea4925368d559d746389099f1ca7.png)
![wsdl2masheryfile.thumb.png.c23a59d78ac5fa095c17f04fde7f5e61.png](http://content.invisioncic.com/s329579/monthly_2024_01/wsdl2masheryfile.thumb.png.c23a59d78ac5fa095c17f04fde7f5e61.png)
Swagger2IODocs
This tool consumes a Swagger-based API definition (Swagger 2.0 only is supported at this point) and creates a Mashery IO Docs definition. The tool can be run in preview mode before being executed against a specific area. When run in preview mode, the generated IO Docs is printed to the browser, and can be copied/pasted into the IO Docs editor in the Mashery Control Center. When executed against a specific area, the IO Docs definition is created in the target area if none already exists, or updated if a definition does exist.
NEW feature: an option to generate a sample response from a schema object in a textarea control. In order to render the sample in a syntax highlighting control, the following additional steps are required:
- Add the following to the Head JavaScript section in the Portal Settings page:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script type="text/javascript"> var $j = jQuery.noConflict(); </script>
- Add the following styles to the last-minute CSS section:
pre.sample { margin: 0; height: 150px; resize: both; overflow: auto; }
- Add the following to the Body JavaScript section:
portalReady(function () { /************************************************* * IODocs syntax highlighting for Swagger sample * *************************************************/ var iodocs = document.querySelector("#page-ioDocs"); if (undefined !== iodocs) { var sample = $j( "textarea[name='params[response_sample]']" ); if (undefined !== sample) { sample.addClass("sample"); $j( "textarea.sample").before(function () { var json = $j(this).val(); if (undefined !== json) { return "<pre class='response prettyprint sample'>" + json + "</pre>" } else { return ""; } }); sample.hide(); prettyPrint(); } } });
Caution: No warning is provided before overwriting an existing IO Docs definition. Use with care.
Note: This tool provides partial support for schema objects used as method parameters. Specifically, arrays/lists of schema objects are not supported at this point.
Disclaimer
NOTE: These tools are applications built using the public TIBCO Mashery V3 API. This API is an official part of the product. These applications and the code within this repository are not supported directly by TIBCO and are intended to be used as starter code and/or community-supported applications.
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now