getJourneyDateRangeKpi method
Retrieves (queries) pre-aggregated data for a standard engagement metric that applies to a journey.
May throw BadRequestException. May throw InternalServerErrorException. May throw PayloadTooLargeException. May throw ForbiddenException. May throw NotFoundException. May throw MethodNotAllowedException. May throw TooManyRequestsException.
Parameter applicationId
:
The unique identifier for the application. This identifier is displayed as
the Project ID on the Amazon Pinpoint console.
Parameter journeyId
:
The unique identifier for the journey.
Parameter kpiName
:
The name of the metric, also referred to as a key performance indicator
(KPI), to retrieve data for. This value describes the associated
metric and consists of two or more terms, which are comprised of lowercase
alphanumeric characters, separated by a hyphen. Examples are
email-open-rate and successful-delivery-rate. For a list of valid values,
see the Amazon
Pinpoint Developer Guide.
Parameter endTime
:
The last date and time to retrieve data for, as part of an inclusive date
range that filters the query results. This value should be in extended ISO
8601 format and use Coordinated Universal Time (UTC), for example:
2019-07-26T20:00:00Z for 8:00 PM UTC July 26, 2019.
Parameter nextToken
:
The string that specifies which page of results to return in a paginated
response. This parameter is not supported for application, campaign, and
journey metrics.
Parameter pageSize
:
The maximum number of items to include in each page of a paginated
response. This parameter is not supported for application, campaign, and
journey metrics.
Parameter startTime
:
The first date and time to retrieve data for, as part of an inclusive date
range that filters the query results. This value should be in extended ISO
8601 format and use Coordinated Universal Time (UTC), for example:
2019-07-19T20:00:00Z for 8:00 PM UTC July 19, 2019. This value should also
be fewer than 90 days from the current day.
Implementation
Future<GetJourneyDateRangeKpiResponse> getJourneyDateRangeKpi({
required String applicationId,
required String journeyId,
required String kpiName,
DateTime? endTime,
String? nextToken,
String? pageSize,
DateTime? startTime,
}) async {
ArgumentError.checkNotNull(applicationId, 'applicationId');
ArgumentError.checkNotNull(journeyId, 'journeyId');
ArgumentError.checkNotNull(kpiName, 'kpiName');
final $query = <String, List<String>>{
if (endTime != null) 'end-time': [_s.iso8601ToJson(endTime).toString()],
if (nextToken != null) 'next-token': [nextToken],
if (pageSize != null) 'page-size': [pageSize],
if (startTime != null)
'start-time': [_s.iso8601ToJson(startTime).toString()],
};
final response = await _protocol.sendRaw(
payload: null,
method: 'GET',
requestUri:
'/v1/apps/${Uri.encodeComponent(applicationId)}/journeys/${Uri.encodeComponent(journeyId)}/kpis/daterange/${Uri.encodeComponent(kpiName)}',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
final $json = await _s.jsonFromResponse(response);
return GetJourneyDateRangeKpiResponse(
journeyDateRangeKpiResponse: JourneyDateRangeKpiResponse.fromJson($json),
);
}