Skip to content

/AWS1/IF_WA2=>GETTOPPATHSTATSBYTRAFFIC()

About GetTopPathStatisticsByTraffic

Retrieves aggregated statistics about the top URI paths accessed by bot traffic for a specified web ACL and time window. You can use this operation to analyze which paths on your web application receive the most bot traffic and identify the specific bots accessing those paths. The operation supports filtering by bot category, organization, or name, and allows you to drill down into specific path prefixes to view detailed URI-level statistics.

Method Signature

METHODS /AWS1/IF_WA2~GETTOPPATHSTATSBYTRAFFIC
  IMPORTING
    !IV_WEBACLARN TYPE /AWS1/WA2RESOURCEARN OPTIONAL
    !IV_SCOPE TYPE /AWS1/WA2SCOPE OPTIONAL
    !IV_URIPATHPREFIX TYPE /AWS1/WA2URIPATHPREFIXSTRING OPTIONAL
    !IO_TIMEWINDOW TYPE REF TO /AWS1/CL_WA2TIMEWINDOW OPTIONAL
    !IV_BOTCATEGORY TYPE /AWS1/WA2FILTERSTRING OPTIONAL
    !IV_BOTORGANIZATION TYPE /AWS1/WA2FILTERSTRING OPTIONAL
    !IV_BOTNAME TYPE /AWS1/WA2FILTERSTRING OPTIONAL
    !IV_LIMIT TYPE /AWS1/WA2PATHSTATISTICSLIMIT OPTIONAL
    !IV_NUMOFTOPTRAFBOTSPERPATH TYPE /AWS1/WA2NOOFTOPTRFBOTSPERPATH OPTIONAL
    !IV_NEXTMARKER TYPE /AWS1/WA2NEXTMARKER OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_wa2gettoppathstatsb01
  RAISING
    /AWS1/CX_WA2WAFFTNOTINCLDINP00
    /AWS1/CX_WA2WAFINTERNALERROREX
    /AWS1/CX_WA2WAFINVALIDOPEX
    /AWS1/CX_WA2WAFINVALIDPARAMEX
    /AWS1/CX_WA2WAFNONEXENTITEMEX
    /AWS1/CX_WA2CLIENTEXC
    /AWS1/CX_WA2SERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_webaclarn TYPE /AWS1/WA2RESOURCEARN /AWS1/WA2RESOURCEARN

The Amazon Resource Name (ARN) of the web ACL for which you want to retrieve path statistics.

iv_scope TYPE /AWS1/WA2SCOPE /AWS1/WA2SCOPE

Specifies whether the web ACL is for an Amazon Web Services CloudFront distribution or for a regional application. A regional application can be an Application Load Balancer, an AppSync GraphQL API, an Amazon Cognito user pool, an Amazon Web Services App Runner service, or an Amazon Web Services Verified Access instance.

io_timewindow TYPE REF TO /AWS1/CL_WA2TIMEWINDOW /AWS1/CL_WA2TIMEWINDOW

The time window for which you want to retrieve path statistics. The time window must be within the data retention period for your web ACL.

iv_limit TYPE /AWS1/WA2PATHSTATISTICSLIMIT /AWS1/WA2PATHSTATISTICSLIMIT

The maximum number of path statistics to return. Valid values are 1 to 100.

iv_numoftoptrafbotsperpath TYPE /AWS1/WA2NOOFTOPTRFBOTSPERPATH /AWS1/WA2NOOFTOPTRFBOTSPERPATH

The maximum number of top bots to include in the statistics for each path. Valid values are 1 to 10.

Optional arguments:

iv_uripathprefix TYPE /AWS1/WA2URIPATHPREFIXSTRING /AWS1/WA2URIPATHPREFIXSTRING

A URI path prefix to filter the results. When you specify this parameter, the operation returns statistics for individual URIs within the specified path prefix. For example, if you specify /api, the response includes statistics for paths like /api/v1/users and /api/v2/orders. If you don't specify this parameter, the operation returns top-level path statistics.

iv_botcategory TYPE /AWS1/WA2FILTERSTRING /AWS1/WA2FILTERSTRING

Filters the results to include only traffic from bots in the specified category. For example, you can filter by ai to see only AI crawler traffic, or search_engine to see only search engine bot traffic. When you apply this filter, the Source field is populated in the response.

iv_botorganization TYPE /AWS1/WA2FILTERSTRING /AWS1/WA2FILTERSTRING

Filters the results to include only traffic from bots belonging to the specified organization. For example, you can filter by openai or google. When you apply this filter, the Source field is populated in the response.

iv_botname TYPE /AWS1/WA2FILTERSTRING /AWS1/WA2FILTERSTRING

Filters the results to include only traffic from the specified bot. For example, you can filter by gptbot or googlebot. When you apply this filter, the Source field is populated in the response.

iv_nextmarker TYPE /AWS1/WA2NEXTMARKER /AWS1/WA2NEXTMARKER

When you request a list of objects with a Limit setting, if the number of objects that are still available for retrieval exceeds the limit, WAF returns a NextMarker value in the response. To retrieve the next batch of objects, provide the marker from the prior call in your next request.

RETURNING

oo_output TYPE REF TO /aws1/cl_wa2gettoppathstatsb01 /AWS1/CL_WA2GETTOPPATHSTATSB01

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->gettoppathstatsbytraffic(
  io_timewindow = new /aws1/cl_wa2timewindow(
    iv_endtime = '20150101000000.0000000'
    iv_starttime = '20150101000000.0000000'
  )
  iv_botcategory = |string|
  iv_botname = |string|
  iv_botorganization = |string|
  iv_limit = 123
  iv_nextmarker = |string|
  iv_numoftoptrafbotsperpath = 123
  iv_scope = |string|
  iv_uripathprefix = |string|
  iv_webaclarn = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_pathstatistics( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lo_filtersource = lo_row_1->get_source( ).
      IF lo_filtersource IS NOT INITIAL.
        lv_filterstring = lo_filtersource->get_botcategory( ).
        lv_filterstring = lo_filtersource->get_botorganization( ).
        lv_filterstring = lo_filtersource->get_botname( ).
      ENDIF.
      lv_pathstring = lo_row_1->get_path( ).
      lv_requestcount = lo_row_1->get_requestcount( ).
      lv_percentagevalue = lo_row_1->get_percentage( ).
      LOOP AT lo_row_1->get_topbots( ) into lo_row_2.
        lo_row_3 = lo_row_2.
        IF lo_row_3 IS NOT INITIAL.
          lv_filterstring = lo_row_3->get_botname( ).
          lv_requestcount = lo_row_3->get_requestcount( ).
          lv_percentagevalue = lo_row_3->get_percentage( ).
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
  lv_requestcount = lo_result->get_totalrequestcount( ).
  lv_nextmarker = lo_result->get_nextmarker( ).
  LOOP AT lo_result->get_topcategories( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lo_filtersource = lo_row_1->get_source( ).
      IF lo_filtersource IS NOT INITIAL.
        lv_filterstring = lo_filtersource->get_botcategory( ).
        lv_filterstring = lo_filtersource->get_botorganization( ).
        lv_filterstring = lo_filtersource->get_botname( ).
      ENDIF.
      lv_pathstring = lo_row_1->get_path( ).
      lv_requestcount = lo_row_1->get_requestcount( ).
      lv_percentagevalue = lo_row_1->get_percentage( ).
      LOOP AT lo_row_1->get_topbots( ) into lo_row_2.
        lo_row_3 = lo_row_2.
        IF lo_row_3 IS NOT INITIAL.
          lv_filterstring = lo_row_3->get_botname( ).
          lv_requestcount = lo_row_3->get_requestcount( ).
          lv_percentagevalue = lo_row_3->get_percentage( ).
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
ENDIF.