Skip to content

sematext/sematext-api-client-javascript

Repository files navigation

  sematext-api-client-javascript


A Sematext Cloud API client, for interaction with Sematext Cloud solution monitoring, alerting and log shipping.


License


One of a family of clients in following flavours:


Refer to below link for deeper information on the API itself.


Contents


Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.


Installation

Node.js

Install via:

npm install @sematext/sematext-api-client --save
const Stcloud = require("@sematext/sematext-api-client")

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}


Authentication

This client code requires a Sematext API Access token to function. You can find this by logging into your Sematext Cloud Account

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

var SematextApiClientJavascript = require('sematext-api-client-javascript')

var defaultClient = SematextApiClientJavascript.ApiClient.instance

// Configure API key authorization: api_key
var api_key = defaultClient.authentications['api_key']
api_key.apiKey = 'YOUR API KEY'
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix['Authorization'] = "Token"

var api = new SematextApiClientJavascript.AlertNotificationsApi()

var appId = 789 // {Number} appId

var timeInterval = new SematextApiClientJavascript.AlertNotificationRequest() // {AlertNotificationRequest} Time Interval

api.getAlertNotificationsForAppUsingPOST(appId, timeInterval).then(
  function (data) {
    console.log('API called successfully. Returned data: ' + data)
  },
  function (error) {
    console.error(error)
  }
)



Testing

Note: Tests are currently inhibited by a Mocha dependancy on Yargs. This client is generated code so this should have litle impact. Marking as a pre-release until this is resolved upstream.



Documentation for API Endpoints

All URIs are relative to https://localhost

Class Method HTTP request Description
SematextApiClientJavascript.AlertNotificationsApi getAlertNotificationsForAppUsingPOST POST /users-web/api/v3/apps/{appId}/notifications/alerts Get alert notifications for an app
SematextApiClientJavascript.AlertNotificationsApi getAlertNotificationsForUserUsingPOST1 POST /users-web/api/v3/notifications/alerts Get alert notifications for a user
SematextApiClientJavascript.AlertsApi createAlertUsingPOST POST /users-web/api/v3/alerts Create alert rule
SematextApiClientJavascript.AlertsApi deleteAlertRuleUsingDELETE DELETE /users-web/api/v3/alerts/{updateableAlertId} Delete alert rule
SematextApiClientJavascript.AlertsApi disableAlertRuleUsingPUT PUT /users-web/api/v3/alerts/{updateableAlertId}/disable Disable alert rule
SematextApiClientJavascript.AlertsApi enableAlertRuleUsingPUT1 PUT /users-web/api/v3/alerts/{updateableAlertId}/enable Enable alert rule
SematextApiClientJavascript.AlertsApi getAlertRulesForAppUsingGET GET /users-web/api/v3/apps/{appId}/alerts Get alert rules for an app
SematextApiClientJavascript.AppsApi deleteUsingDELETE DELETE /users-web/api/v3/apps/{anyStateAppId} delete
SematextApiClientJavascript.AppsApi getAppTypesUsingGET1 GET /users-web/api/v3/apps/types Get all App types supported for the account identified with apiKey
SematextApiClientJavascript.AppsApi getUsingGET GET /users-web/api/v3/apps/{anyStateAppId} Gets defails for one particular App
SematextApiClientJavascript.AppsApi inviteAppGuestsUsingPOST POST /users-web/api/v3/apps/guests Invite guests to an app
SematextApiClientJavascript.AppsApi listAppsUsersUsingGET1 GET /users-web/api/v3/apps/users Get all users of apps accessible to this account
SematextApiClientJavascript.AppsApi listUsingGET1 GET /users-web/api/v3/apps Get all apps accessible by account identified with apiKey
SematextApiClientJavascript.AppsApi updateDescriptionUsingPUT1 PUT /users-web/api/v3/apps/{anyStateAppId}/description Update description of the app
SematextApiClientJavascript.AppsApi updateUsingPUT2 PUT /users-web/api/v3/apps/{anyStateAppId} Update app
SematextApiClientJavascript.AwsSettingsControllerApi updateUsingPUT PUT /users-web/api/v3/apps/{appId}/aws Update App's AWS CloudWatch settings
SematextApiClientJavascript.BillingApi getDetailedInvoiceUsingGET GET /users-web/api/v3/billing/invoice/{service}/{year}/{month} Get invoice details
SematextApiClientJavascript.BillingApi listAvailablePlansUsingGET1 GET /users-web/api/v3/billing/availablePlans Get available plans
SematextApiClientJavascript.BillingApi updatePlanUsingPUT1 PUT /users-web/api/v3/billing/info/{appId} Update plan for an app
SematextApiClientJavascript.LogsAppApi createLogseneApplication POST /logsene-reports/api/v3/apps Create Logs App
SematextApiClientJavascript.MonitoringAppApi createSpmApplication1 POST /spm-reports/api/v3/apps Create Monitoring App
SematextApiClientJavascript.ResetPasswordApi resetPasswordUsingPOST POST /users-web/api/v3/account/password/reset Reset Password
SematextApiClientJavascript.SubscriptionsApi createForAppUsingPOST POST /users-web/api/v3/apps/{appId}/subscription Create App subscription
SematextApiClientJavascript.SubscriptionsApi createForDashUsingPOST1 POST /users-web/api/v3/dashboards/{dashId}/subscription Create dashboard subscription
SematextApiClientJavascript.SubscriptionsApi deleteUsingDELETE2 DELETE /users-web/api/v3/subscriptions/{updateableSubscriptionId} Delete subscription
SematextApiClientJavascript.SubscriptionsApi listUsingGET3 GET /users-web/api/v3/apps/{appId}/subscriptions Get subscriptions for an App
SematextApiClientJavascript.SubscriptionsApi listUsingGET4 GET /users-web/api/v3/subscriptions Get current account's subscriptions
SematextApiClientJavascript.SubscriptionsApi sendAppReportUsingPOST1 POST /users-web/api/v3/apps/{appId}/report/send Email an App report
SematextApiClientJavascript.SubscriptionsApi sendDashReportUsingPOST POST /users-web/api/v3/dashboards/{dashId}/report/send Email a dashboard report
SematextApiClientJavascript.SubscriptionsApi toggleEnabledUsingPUT1 PUT /users-web/api/v3/subscriptions/{updateableSubscriptionId} Toggle subscription status
SematextApiClientJavascript.SubscriptionsApi updateForAppUsingPUT PUT /users-web/api/v3/apps/{appId}/subscription Update App subscription
SematextApiClientJavascript.SubscriptionsApi updateForDashUsingPUT1 PUT /users-web/api/v3/dashboards/{dashId}/subscription Update dashboard subscription
SematextApiClientJavascript.TagApiControllerApi getTagNamesUsingGET1 GET /spm-reports/api/v3/apps/{appIds}/tagNames Gets tag names for the given application identifiers appearing in the given time frame.
SematextApiClientJavascript.TagApiControllerApi getUsingGET1 GET /spm-reports/api/v3/apps/{appIds}/tags Gets values for specified tags for the given application identifiers appearing in the given time frame.
SematextApiClientJavascript.TagApiControllerApi getUsingGET2 GET /spm-reports/api/v3/apps/{appIds}/metrics/filters Gets values for specified tags for the given application identifiers appearing in the given time frame.
SematextApiClientJavascript.TokensApiControllerApi createAppToken1 POST /users-web/api/v3/apps/{appId}/tokens Create new app token
SematextApiClientJavascript.TokensApiControllerApi deleteAppToken1 DELETE /users-web/api/v3/apps/{appId}/tokens/{tokenId} Delete app token
SematextApiClientJavascript.TokensApiControllerApi getAppTokens GET /users-web/api/v3/apps/{appId}/tokens Get app available tokens
SematextApiClientJavascript.TokensApiControllerApi regenerateAppToken POST /users-web/api/v3/apps/{appId}/tokens/{tokenId}/regenerate Regenerate app token)
SematextApiClientJavascript.TokensApiControllerApi updateAppToken1 PUT /users-web/api/v3/apps/{appId}/tokens/{tokenId} Update app token (enable/disable or name)

Documentation for Models