Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Latest commit

 

History

History
307 lines (219 loc) · 9.47 KB

EventsApi.md

File metadata and controls

307 lines (219 loc) · 9.47 KB

EventsApi

All URIs are relative to https://api.getlago.com/api/v1

Method HTTP request Description
createBatchEvents POST /events/batch Batch multiple events
createEvent POST /events Send usage events
eventEstimateFees POST /events/estimate_fees Estimate fees for a pay in advance charge
findEvent GET /events/{transaction_id} Retrieve a specific event

createBatchEvents

createBatchEvents(eventBatchInput)

Batch multiple events

This endpoint is used for transmitting a batch of usage measurement events to multiple subscriptions for a single customer.

Example

// Import classes:
import org.getlago.client.ApiClient;
import org.getlago.client.ApiException;
import org.getlago.client.Configuration;
import org.getlago.client.auth.*;
import org.getlago.client.models.*;
import org.getlago.client.api.EventsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.getlago.com/api/v1");
        
        // Configure HTTP bearer authorization: bearerAuth
        HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
        bearerAuth.setBearerToken("BEARER TOKEN");

        EventsApi apiInstance = new EventsApi(defaultClient);
        EventBatchInput eventBatchInput = new EventBatchInput(); // EventBatchInput | Batch events payload
        try {
            apiInstance.createBatchEvents(eventBatchInput);
        } catch (ApiException e) {
            System.err.println("Exception when calling EventsApi#createBatchEvents");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
eventBatchInput EventBatchInput Batch events payload

Return type

null (empty response body)

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Event received -
400 Bad Request error -
401 Unauthorized error -
422 Unprocessable entity error -

createEvent

Event createEvent(eventInput)

Send usage events

This endpoint is used for transmitting usage measurement events to either a designated customer or a specific subscription.

Example

// Import classes:
import org.getlago.client.ApiClient;
import org.getlago.client.ApiException;
import org.getlago.client.Configuration;
import org.getlago.client.auth.*;
import org.getlago.client.models.*;
import org.getlago.client.api.EventsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.getlago.com/api/v1");
        
        // Configure HTTP bearer authorization: bearerAuth
        HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
        bearerAuth.setBearerToken("BEARER TOKEN");

        EventsApi apiInstance = new EventsApi(defaultClient);
        EventInput eventInput = new EventInput(); // EventInput | Event payload
        try {
            Event result = apiInstance.createEvent(eventInput);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling EventsApi#createEvent");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
eventInput EventInput Event payload

Return type

Event

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Event -
400 Bad Request error -
401 Unauthorized error -
422 Unprocessable entity error -

eventEstimateFees

Fees eventEstimateFees(eventEstimateFeesInput)

Estimate fees for a pay in advance charge

Estimate the fees that would be created after reception of an event for a billable metric attached to one or multiple pay in advance charges

Example

// Import classes:
import org.getlago.client.ApiClient;
import org.getlago.client.ApiException;
import org.getlago.client.Configuration;
import org.getlago.client.auth.*;
import org.getlago.client.models.*;
import org.getlago.client.api.EventsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.getlago.com/api/v1");
        
        // Configure HTTP bearer authorization: bearerAuth
        HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
        bearerAuth.setBearerToken("BEARER TOKEN");

        EventsApi apiInstance = new EventsApi(defaultClient);
        EventEstimateFeesInput eventEstimateFeesInput = new EventEstimateFeesInput(); // EventEstimateFeesInput | Event estimate payload
        try {
            Fees result = apiInstance.eventEstimateFees(eventEstimateFeesInput);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling EventsApi#eventEstimateFees");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
eventEstimateFeesInput EventEstimateFeesInput Event estimate payload

Return type

Fees

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Fees estimate -
400 Bad Request error -
401 Unauthorized error -
404 Not Found error -
422 Unprocessable entity error -

findEvent

Event findEvent(transactionId)

Retrieve a specific event

This endpoint is used for retrieving a specific usage measurement event that has been sent to a customer or a subscription.

Example

// Import classes:
import org.getlago.client.ApiClient;
import org.getlago.client.ApiException;
import org.getlago.client.Configuration;
import org.getlago.client.auth.*;
import org.getlago.client.models.*;
import org.getlago.client.api.EventsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.getlago.com/api/v1");
        
        // Configure HTTP bearer authorization: bearerAuth
        HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
        bearerAuth.setBearerToken("BEARER TOKEN");

        EventsApi apiInstance = new EventsApi(defaultClient);
        String transactionId = "transaction_1234567890"; // String | This field represents the unique identifier sent for this specific event.
        try {
            Event result = apiInstance.findEvent(transactionId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling EventsApi#findEvent");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
transactionId String This field represents the unique identifier sent for this specific event.

Return type

Event

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Event -
401 Unauthorized error -
404 Not Found error -