Skip to content

Latest commit

 

History

History
156 lines (120 loc) · 6.33 KB

EventIngestionApi.md

File metadata and controls

156 lines (120 loc) · 6.33 KB

EventIngestionApi

All URIs are relative to https://api.togai.com

Method HTTP request Description
ingest POST /ingest Ingest events to Togai
ingestBatch POST /ingestBatch Ingest events to Togai in batch

ingest

ingest(ingestEventRequest)

Ingest events to Togai

This API let’s you to ingest events to your Togai account. Events ingested using this API will be processed via associated usage meters and further via associated price plans to generate final billable value to invoice the customer Read more about Event Ingestion

Example

// Import classes:
import com.togai.client.ApiClient;
import com.togai.client.ApiException;
import com.togai.client.Configuration;
import com.togai.client.auth.*;
import com.togai.client.models.*;
import com.togai.client.api.EventIngestionApi;

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

    EventIngestionApi apiInstance = new EventIngestionApi(defaultClient);
    IngestEventRequest ingestEventRequest = new IngestEventRequest(); // IngestEventRequest | Request body to ingest events to Togai usage and billing management service.
    try {
      apiInstance.ingest(ingestEventRequest);
    } catch (ApiException e) {
      System.err.println("Exception when calling EventIngestionApi#ingest");
      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
ingestEventRequest IngestEventRequest Request body to ingest events to Togai usage and billing management service.

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
202 Successfully accepted to process all the events from payload. -
400 Bad request. Please check the response message for failure details. -
401 Credential "x-api-key" is not valid. Please check the response message for failure details. -
422 Unable to process the events as the size of the event payload is above the supported limit. Please check our docs for the api limits - https://togai.com/docs/limits. -
429 Request throttled. Please check the response message on the failure details. -
503 Service is currently unavailable to process the request. -
0 Error response -

ingestBatch

IngestBatchEventResponse ingestBatch(ingestBatchEventRequest)

Ingest events to Togai in batch

This API let’s you to ingest events in batch upto 1000 events. Ingest large amounts of events up to 1000 in batches in an array using this API.

Example

// Import classes:
import com.togai.client.ApiClient;
import com.togai.client.ApiException;
import com.togai.client.Configuration;
import com.togai.client.auth.*;
import com.togai.client.models.*;
import com.togai.client.api.EventIngestionApi;

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

    EventIngestionApi apiInstance = new EventIngestionApi(defaultClient);
    IngestBatchEventRequest ingestBatchEventRequest = new IngestBatchEventRequest(); // IngestBatchEventRequest | Request body to ingest events in batch to Togai usage and billing management service.
    try {
      IngestBatchEventResponse result = apiInstance.ingestBatch(ingestBatchEventRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling EventIngestionApi#ingestBatch");
      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
ingestBatchEventRequest IngestBatchEventRequest Request body to ingest events in batch to Togai usage and billing management service.

Return type

IngestBatchEventResponse

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
202 Successfully accepted to process all the events from payload. -
207 Partial failure. Few events from request were not accepted -
400 Bad request. Please check the response message for failure details. -
401 Credential "x-api-key" is not valid. Please check the response message for failure details. -
422 Unable to process the events as the size of the event payload is above the supported limit. Please check our docs for the api limits - https://togai.com/docs/limits. -
429 Request throttled. Please check the response message on the failure details. -
503 Service is currently unavailable to process the request. -
0 Error response -