Skip to content

Latest commit

 

History

History
289 lines (211 loc) · 8.75 KB

UsageApi.md

File metadata and controls

289 lines (211 loc) · 8.75 KB

UsageApi

All URIs are relative to https://{customerId}.billabear.cloud/api/v1

Method HTTP request Description
createCustomerUsageLimit POST /customer/{customerId}/uasge-limit Create Usage Limit
createEvent POST /events Create Event
customerCustomerIdUasgeLimitLimitIdDelete DELETE /customer/{customerId}/uasge-limit/{limitId} Delete Usage Limit
getCustomerCosts GET /customer/{customerId}/costs Usage Cost Estimate
getCustomerUsageLimitsById GET /customer/{customerId}/uasge-limit Fetch Customer Usage Limits

createCustomerUsageLimit

UsageLimit createCustomerUsageLimit(body, customerId)

Create Usage Limit

Create Usage Limit for the custoemr

Example

// Import classes:
//import com.billabear.sdk.invoker.ApiClient;
//import com.billabear.sdk.invoker.ApiException;
//import com.billabear.sdk.invoker.Configuration;
//import com.billabear.sdk.invoker.auth.*;
//import com.billabear.sdk.api.UsageApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

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

UsageApi apiInstance = new UsageApi();
CustomerIdUasgelimitBody body = new CustomerIdUasgelimitBody(); // CustomerIdUasgelimitBody | 
String customerId = "customerId_example"; // String | The id of the customer to retrieve
try {
    UsageLimit result = apiInstance.createCustomerUsageLimit(body, customerId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling UsageApi#createCustomerUsageLimit");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body CustomerIdUasgelimitBody
customerId String The id of the customer to retrieve

Return type

UsageLimit

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

createEvent

createEvent(body)

Create Event

Creates an event that is used for usage billing

Example

// Import classes:
//import com.billabear.sdk.invoker.ApiClient;
//import com.billabear.sdk.invoker.ApiException;
//import com.billabear.sdk.invoker.Configuration;
//import com.billabear.sdk.invoker.auth.*;
//import com.billabear.sdk.api.UsageApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

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

UsageApi apiInstance = new UsageApi();
Event body = new Event(); // Event | 
try {
    apiInstance.createEvent(body);
} catch (ApiException e) {
    System.err.println("Exception when calling UsageApi#createEvent");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body Event

Return type

null (empty response body)

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

customerCustomerIdUasgeLimitLimitIdDelete

customerCustomerIdUasgeLimitLimitIdDelete(customerId, usageLimitId)

Delete Usage Limit

Delete Usage Limit for the custoemr

Example

// Import classes:
//import com.billabear.sdk.invoker.ApiClient;
//import com.billabear.sdk.invoker.ApiException;
//import com.billabear.sdk.invoker.Configuration;
//import com.billabear.sdk.invoker.auth.*;
//import com.billabear.sdk.api.UsageApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

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

UsageApi apiInstance = new UsageApi();
String customerId = "customerId_example"; // String | The id of the customer to retrieve
String usageLimitId = "usageLimitId_example"; // String | The id of the usage limit
try {
    apiInstance.customerCustomerIdUasgeLimitLimitIdDelete(customerId, usageLimitId);
} catch (ApiException e) {
    System.err.println("Exception when calling UsageApi#customerCustomerIdUasgeLimitLimitIdDelete");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
customerId String The id of the customer to retrieve
usageLimitId String The id of the usage limit

Return type

null (empty response body)

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

getCustomerCosts

InlineResponse2001 getCustomerCosts(customerId)

Usage Cost Estimate

The estimated costs from usage based billing for a customer

Example

// Import classes:
//import com.billabear.sdk.invoker.ApiClient;
//import com.billabear.sdk.invoker.ApiException;
//import com.billabear.sdk.invoker.Configuration;
//import com.billabear.sdk.invoker.auth.*;
//import com.billabear.sdk.api.UsageApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

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

UsageApi apiInstance = new UsageApi();
String customerId = "customerId_example"; // String | The id of the customer to retrieve
try {
    InlineResponse2001 result = apiInstance.getCustomerCosts(customerId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling UsageApi#getCustomerCosts");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
customerId String The id of the customer to retrieve

Return type

InlineResponse2001

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getCustomerUsageLimitsById

InlineResponse2005 getCustomerUsageLimitsById(customerId)

Fetch Customer Usage Limits

Usage Limits for a specific customer

Example

// Import classes:
//import com.billabear.sdk.invoker.ApiClient;
//import com.billabear.sdk.invoker.ApiException;
//import com.billabear.sdk.invoker.Configuration;
//import com.billabear.sdk.invoker.auth.*;
//import com.billabear.sdk.api.UsageApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

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

UsageApi apiInstance = new UsageApi();
String customerId = "customerId_example"; // String | The id of the customer to retrieve
try {
    InlineResponse2005 result = apiInstance.getCustomerUsageLimitsById(customerId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling UsageApi#getCustomerUsageLimitsById");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
customerId String The id of the customer to retrieve

Return type

InlineResponse2005

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json