Skip to content

vantage-sh/vantage-js

Repository files navigation

Build Status

Vantage Javascript Client

Vantage Picture

Vantage is a cloud cost transparency platform. This is the official Javascript client for the Vantage API. You can use the API to get EC2 instance price and product information through a few simple-to-use API calls. The data offered through this API is heavily inspired from data avaiable from ec2instances.info. The feedback we get from users is that this API is significantly easier than learning and using AWS Pricing APIs. We have plans to expand the data available through this API in the future.

Need Help?

Feel free to join us in our community Slack in the #api channel. We're happy to chat and help. You're also welcome to email [email protected] or ping @JoinVantage on Twitter and we're happy to give assistance. Lastly, we monitor issues on this repo if you have any feature requests or issues.

Installation

The easiest way to get going is to install the client through NPM:

npm i @vantage-sh/vantage-client --save

Generate a Free API Token

The Vantage API is provided completely for free but requires an API token to use. To generate a free API token, follow these steps:

  • Head to http://vantage.sh/
  • Register a free account and confirm your email
  • When you're asked "What would you like to do first?" click "Access Cloud Pricing API"
  • Create an API token from the account profile page and you're all set

You'll only need to do this once and you can use your API token for all usage going forward.

Client

Vantage - JavaScript client for vantage Vantage API This SDK is automatically generated by the Swagger Codegen project:

For more information, please visit https://www.vantage.sh

Getting Started

Please follow the installation instruction and execute the following JS code:

var Vantage = require('vantage');

var defaultClient = Vantage.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = "YOUR ACCESS TOKEN"

var api = new Vantage.CostsApi()

var reportId = "reportId_example"; // {String} 

var opts = { 
  'startDate': "startDate_example", // {String} Query costs by the first date you would like to filter from. ISO 8601 Formatted - 2021-07-15 or 2021-07-15T19:20:48+00:00.
  'endDate': "endDate_example", // {String} Query costs by the last date you would like to filter to. ISO 8601 Formatted - 2021-07-15 or 2021-07-15T19:20:48+00:00.
  'page': 2, // {Number} The page of results to return.
  'limit': 500 // {Number} The amount of results to return. The maximum is 1000
};
api.getCosts(reportId, opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Documentation for API Endpoints

All URIs are relative to https://api.vantage.sh

Class Method HTTP request Description
Vantage.CostsApi getCosts GET /v1/reports/{report_id}/costs
Vantage.CostsApi getReport GET /v1/reports/{report_id}
Vantage.CostsApi getReports GET /v1/reports
Vantage.PingApi ping GET /v1/ping
Vantage.PricesApi getPrice GET /v1/products/{product_id}/prices/{id}
Vantage.PricesApi getPrices GET /v1/products/{product_id}/prices
Vantage.PricesApi getProduct GET /v1/products/{id}
Vantage.PricesApi getProducts GET /v1/products
Vantage.PricesApi getProviders GET /v1/providers
Vantage.PricesApi getServices GET /v1/services

Documentation for Models

Documentation for Authorization

oauth2

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes:
    • read: Grants read access

About

Vantage Javascript API Client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published