Search events


Request description

Endpoint: /events/search
Method: POST

{
  "Content-Type": "application/json",
  "Authorization": "Bearer <accessToken>"
}

Note: the <accessToken> is obtained as a result of the authentication

Payload

interface ISearchEventPayload {
  userId: string;
  offset: number;
  period: number;
  outputFormat?: "json" | "csv";
  limit?: number;
}

where:

  • userId: user identification
  • limit: Maximum number of events to return (Value must be between 1 and 100)
  • startTimestamp: Start time (in milliseconds)
  • endTimestamp: End time (in milliseconds)
  • outputFormat: Output format. (JSON by default)

Responses

Correct response

Successful request

Describe the characteristics of a satisfactory response

200

Response structure:

type ListGroupsResponseType = {
  events: IEvent[];
};
Below we will describe the structure of the IEvent interface:
interface IEvent {
  timestamp: string; // ISO string
  eventName: string;
  userId: string;
  organizationId: string;
}

Wrong responses

Unauthorized request

Describe the characteristics of an unauthorized request

401

Response body

{
  // empty body
}

Description: this error occurs when endpoint authorizers fail to validate the token sent in the request header.

Forbidden request

Describe the characteristics of an forbidden request

403

Response body

{
  // empty body
}

Description: this error occurs when your accessToken does not have permission to search for events related to this organization.

Bad request

Describe the characteristics of a bad request

400

Response body

type SearchEventResponseType = {
  errorType: SEARCH_EVENT_ERROR_TYPE;
  errorMessage?: string;
};

enum SearchEventResponseType {
  INVALID_START_TIMESTAMP = "invalidStartTimestamp",
  INVALID_END_TIMESTAMP = "invalidEndTimestamp",
  INVALID_LIMIT = "invalidLimitValue",
  INVALID_OUTPUT_FORMAT = "invalidOutputFormat",
}