Skip to content

sematext/sematext-api-client-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  sematext-api-client-java


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.

Prerequisites

Building the API client library requires:

  1. Java 1.7+
  2. Maven/Gradle

Installing

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

To run tests:

mvn test

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>com.sematext</groupId>
  <artifactId>SematextCloudClient</artifactId>
  <version>0.1.1</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "com.sematext:sematext-api-client-java:0.1.1"

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/swagger-java-client-1.0.1.jar
  • target/lib/*.jar

Authentication

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

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details

Acknowledgements

This API client was initially generated by the swagger-codegen project.

  • API version: v3
  • Package version: 1.0.0

Getting Started

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

import com.sematext.cloud.client.*;
import com.sematext.cloud.client.auth.*;
import com.sematext.cloud.client.model.*;
import com.sematext.cloud.client.api.AlertNotificationsApi;

import java.io.File;
import java.util.*;

public class AlertNotificationsApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure API key authorization: api_key
        ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key");
        api_key.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //api_key.setApiKeyPrefix("Token");

        AlertNotificationsApi apiInstance = new AlertNotificationsApi();
        Long appId = 789L; // Long | appId
        AlertNotificationRequest timeInterval = new AlertNotificationRequest(); // AlertNotificationRequest | Time Interval
        try {
            GenericApiResponse result = apiInstance.getAlertNotificationsForAppUsingPOST(appId, timeInterval);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AlertNotificationsApi#getAlertNotificationsForAppUsingPOST");
            e.printStackTrace();
        }
    }
}

Reference

All URIs are relative to https://localhost

Class Method HTTP request Description
AlertNotificationsApi getAlertNotificationsForAppUsingPOST POST /users-web/api/v3/apps/{appId}/notifications/alerts Get alert notifications for an app
AlertNotificationsApi getAlertNotificationsForUserUsingPOST POST /users-web/api/v3/notifications/alerts Get alert notifications for a user
AlertsApi createAlertUsingPOST POST /users-web/api/v3/alerts Create alert rule
AlertsApi deleteAlertRuleUsingDELETE DELETE /users-web/api/v3/alerts/{updateableAlertId} Delete alert rule
AlertsApi disableAlertRuleUsingPUT PUT /users-web/api/v3/alerts/{updateableAlertId}/disable Disable alert rule
AlertsApi enableAlertRuleUsingPUT PUT /users-web/api/v3/alerts/{updateableAlertId}/enable Enable alert rule
AlertsApi getAlertRulesForAppUsingGET GET /users-web/api/v3/apps/{appId}/alerts Get alert rules for an app
AppsApi getAppTypesUsingGET GET /users-web/api/v3/apps/types Get all App types supported for the account identified with apiKey
AppsApi getUsingGET GET /users-web/api/v3/apps/{anyStateAppId} Gets defails for one particular App
AppsApi inviteAppGuestsUsingPOST POST /users-web/api/v3/apps/guests Invite guests to an app
AppsApi listAppsUsersUsingGET GET /users-web/api/v3/apps/users Get all users of apps accessible to this account
AppsApi listUsingGET GET /users-web/api/v3/apps Get all apps accessible by account identified with apiKey
AppsApi updateDescriptionUsingPUT PUT /users-web/api/v3/apps/{anyStateAppId}/description Update description of the app
AppsApi updateUsingPUT1 PUT /users-web/api/v3/apps/{anyStateAppId} Update app
AwsSettingsControllerApi updateUsingPUT PUT /users-web/api/v3/apps/{appId}/aws Update App's AWS CloudWatch settings
BillingApi getDetailedInvoiceUsingGET GET /users-web/api/v3/billing/invoice/{service}/{year}/{month} Get invoice details
BillingApi listAvailablePlansUsingGET GET /users-web/api/v3/billing/availablePlans Get available plans
BillingApi updatePlanUsingPUT PUT /users-web/api/v3/billing/info/{appId} Update plan for an app
LogsAppApi createLogseneApplication POST /logsene-reports/api/v3/apps Create Logs App
MetricsApi listDataSeriesUsingPOST1 POST /spm-reports/api/v3/apps/{appId}/metrics/data Get metrics data points for an app
MetricsApi listFiltersUsingPOST POST /spm-reports/api/v3/apps/{appId}/metrics/filters Get metrics filters and their values for an app
MetricsApi listMetricsKeysUsingGET1 GET /spm-reports/api/v3/apps/{appId}/metrics/keys Get metrics keys for an app
MetricsApi listMetricsUsingGET1 GET /spm-reports/api/v3/apps/{appId}/metrics Get metrics info for an app
MonitoringAppApi createSpmApplication POST /spm-reports/api/v3/apps Create Monitoring App
ResetPasswordApi resetPasswordUsingPOST POST /users-web/api/v3/account/password/reset Reset Password
SavedQueriesApi deleteSavedQueryUsingDELETE DELETE /users-web/api/v3/savedQueries/{updateableQueryId} Delete saved query
SavedQueriesApi getSavedQueriesForAppUsingGET GET /users-web/api/v3/apps/{appId}/savedQueries Get saved queries for an app
SavedQueriesApi saveQueryUsingPOST POST /users-web/api/v3/savedQueries Create saved query
SavedQueriesApi saveQueryUsingPUT PUT /users-web/api/v3/savedQueries/{updateableQueryId} Update saved query
SubscriptionsApi listUsingGET1 GET /users-web/api/v3/apps/{appId}/subscriptions Get subscriptions for an app
SubscriptionsApi sendReportUsingPOST POST /users-web/api/v3/apps/{appId}/report/send Trigger emailing of report for an app
TagApiControllerApi getTagNamesUsingGET GET /spm-reports/api/v3/apps/{appIds}/tagNames Gets tag names for the given application identifiers appearing in the given time frame.
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.
*TagApiControllerAPI getUsingGET3 GET /spm-reports/api/v3/apps/{appIds}/tags Gets values for specified tags for the given application identifiers appearing in the given time frame.
TokensApiControllerApi createAppToken POST /users-web/api/v3/apps/{appId}/tokens Create new app token
TokensApiControllerApi deleteAppToken1 DELETE /users-web/api/v3/apps/{appId}/tokens/{tokenId} Delete app token
TokensApiControllerApi getAppTokens1 GET /users-web/api/v3/apps/{appId}/tokens Get app available tokens
TokensApiControllerApi regenerateAppToken POST /users-web/api/v3/apps/{appId}/tokens/{tokenId}/regenerate Regenerate app token)
TokensApiControllerApi updateAppToken1 PUT /users-web/api/v3/apps/{appId}/tokens/{tokenId} Update app token (enable/disable)

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

api_key

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author