-
Notifications
You must be signed in to change notification settings - Fork 0
Swagger
Steve Greatrex edited this page Feb 27, 2015
·
1 revision
The EDGE10 API includes Swagger support as of March 2015 (in alpha at time of writing).
You can browse the API from http://YourEnvironment.edge10online.com/swagger. To support the UI-based API testing you will need to specify an API key and make sure that you are not logged into the main site.
Using the swagger definition from http://YourEnvironment.edge10online.com/swagger/docs/v1 you are able to automatically generate JavaScript clients for use in Node or in the browser.
var client = require('swagger-client');
var config = require('./sample-config');
client.authorizations.add('apiKey', new client.ApiKeyAuthorization('api_key', config.apiKey, 'query'));
new client.SwaggerClient({
url: config.siteUrl + '/swagger/docs/v1',
success: function() {
//send API information to the log
this.apis.Entity.help();
//make an API call
console.log('\nRunning test for Entity.get...');
this.Entity.get({}, function(response) {
var entities = response.obj;
console.log('Found ' + entities.length + ' entities');
});
}
});See the samples for a full working example.
For more information on the swagger-client implementation, see the code on GitHub.