An open API service indexing awesome lists of open source software.

https://github.com/rootlyhq/rootly-java

Official Rootly Java SDK for incident management API
https://github.com/rootlyhq/rootly-java

api incident-management incident-response java maven openapi rest-api rootly sdk

Last synced: 2 months ago
JSON representation

Official Rootly Java SDK for incident management API

Awesome Lists containing this project

README

          

# rootly-java

Java client library for Rootly incident management platform, auto-generated from OpenAPI specifications.

## Installation

### Maven

Add this dependency to your project's POM:

```xml

com.rootly.client
rootly
0.0.4

```

### Gradle

Add this dependency to your project's build file:

```groovy
dependencies {
implementation 'com.rootly.client:rootly:0.0.4'
}
```

### Local Installation

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

```bash
./gradlew publishToMavenLocal
# or
mvn clean install
```

## Usage

```java
import com.rootly.client.ApiClient;
import com.rootly.client.Configuration;
import com.rootly.client.auth.HttpBearerAuth;
import com.rootly.client.api.IncidentsApi;
import com.rootly.client.model.IncidentList;

public class Example {
public static void main(String[] args) {
// Create and configure the API client
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.rootly.com");

// Configure authentication
HttpBearerAuth bearerAuth = (HttpBearerAuth) client.getAuthentication("bearer_auth");
bearerAuth.setBearerToken("YOUR_API_TOKEN");

// Use the client to make API calls
IncidentsApi incidentsApi = new IncidentsApi(client);
try {
IncidentList incidents = incidentsApi.listIncidents(null, null, null);
System.out.println(incidents);
} catch (Exception e) {
e.printStackTrace();
}
}
}
```

## Getting Your API Key

1. Navigate to **Organization dropdown** > **Organization Settings** > **API Keys**
2. Generate a new API key
3. Use the token in your client configuration

## Development

### Prerequisites

- Java 1.8 or later
- Maven 3.8.3+ or Gradle 7.2+
- [OpenAPI Generator](https://openapi-generator.tech) 7.13.0

### Generating the Code

The SDK is auto-generated from the Rootly OpenAPI specification:

```bash
# Fetch latest spec and regenerate code
make build
```

This will:
1. Fetch the OpenAPI spec from Rootly's S3 bucket
2. Generate Java code using OpenAPI Generator
3. Apply necessary patches

### Building and Testing

- **Build**: `./gradlew build` or `mvn clean package`
- **Test**: `./gradlew test` or `mvn test`
- **Format code**: `./gradlew spotlessApply` or `mvn spotless:apply`

## API Features

### JSON:API Specification

Rootly uses the [JSON:API](https://jsonapi.org) specification:
- Content-Type: `application/vnd.api+json`
- Structured responses with `data`, `attributes`, and `relationships`
- Standardized error handling

### Rate Limiting

- **3000 requests per 60-second sliding window** (per API key)
- Response headers include:
- `RateLimit-Limit`: Maximum requests allowed
- `RateLimit-Remaining`: Remaining requests in current window
- `RateLimit-Reset`: UTC epoch seconds when window resets

Contact your Rootly Customer Success Manager to adjust limits.

### Pagination

Use `page[number]` and `page[size]` query parameters:

```java
// Example: Fetch page 2 with 25 items per page
IncidentList incidents = incidentsApi.listIncidents(
25, // page[size]
2, // page[number]
null // additional filters
);
```

## Generated Code Structure

- **API Classes** (`com.rootly.client.api.*`): Client implementations for all API endpoints
- **Model Classes** (`com.rootly.client.model.*`): Data transfer objects for requests/responses
- **Core Client** (`com.rootly.client.ApiClient`): HTTP client with authentication support
- **Authentication** (`com.rootly.client.auth.*`): Bearer token, API key, and basic auth implementations

## Contributing

This library is auto-generated from OpenAPI specifications. For API changes or issues:
- Report bugs or request features in this repository
- API specification changes should be directed to Rootly

---

*Automatically generated by [OpenAPI Generator](https://openapi-generator.tech)*