var Ceic = require('ceic_api');
var accessToken = "ENTER YOUR API KEY HERE";
var exampleSeriesId = "EXAMPLE SERIES ID";
var apiClient = new Ceic.ApiClient();
var seriesApi = new Ceic.SeriesApi(apiClient);
seriesApi.getSeries(exampleSeriesId, {token: accessToken}).then(function(seriesResult) {
// Access series data result
var series = seriesResult.data[0];
var seriesMetadata = series.metadata;
var seriesTimePoints = series.timePoints;
}, function(error) {
// Handle error
});
seriesApi.getSeriesMetadata(exampleSeriesId, {token: accessToken}).then(function(seriesMetadataResult) {
// Access series metadata result
var seriesMetadata = seriesMetadataResult.data[0].metadata;
var seriesId = seriesMetadata.id;
var seriesFrequency = seriesMetadata.frequency;
var seriesStartDate = seriesMetadata.startDate;
}, function(error) {
// Handle error
});
seriesApi.getSeriesTimePoints(exampleSeriesId, {token: accessToken}).then(function(seriesTimePointsResult) {
// Access series time points data result
var seriesTimePoints = seriesTimePointsResult.data[0].timePoints;
var firstTimePointDate = seriesTimePoints[0].date;
var firstTimePointValue = seriesTimePoints[0].value;
var secondTimePointDate = seriesTimePoints[1].date;
var secondTimePointValue = seriesTimePoints[1].value;
}, function(error) {
// Handle error
});