v1

latestOpenAPI 3.0.0Apache 2.0 License2026-07-1477318454.9 KB

<note> <p>This is <b>AWS WAF Classic</b> documentation. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html">AWS WAF Classic</a> in the developer guide.</p> <p> <b>For the latest version of AWS WAF</b>, use the AWS WAFV2 API and see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS WAF Developer Guide</a>. With the latest version, AWS WAF has a single set of endpoints for regional and global use. </p> </note> <p>Gets detailed information about a specified number of requests--a sample--that AWS WAF randomly selects from among the first 5,000 requests that your AWS resource received during a time range that you choose. You can specify a sample size of up to 500 requests, and you can specify any time range in the previous three hours.</p> <p> <code>GetSampledRequests</code> returns a time range, which is usually the time range that you specified. However, if your resource (such as a CloudFront distribution) received 5,000 requests before the specified time range elapsed, <code>GetSampledRequests</code> returns an updated time range. This new time range indicates the actual period during which AWS WAF selected the requests in the sample.</p>

post/#X-Amz-Target=AWSWAF_20150824.GetSampledRequests

Headers

X-Amz-Target'AWSWAF_20150824.GetSampledRequests' required

Request body

WebAclIdstring required

The <code>WebACLId</code> of the <code>WebACL</code> for which you want <code>GetSampledRequests</code> to return a sample of requests.

RuleIdstring required
<p> <code>RuleId</code> is one of three values:</p> <ul> <li> <p>The <code>RuleId</code> of the <code>Rule</code> or the <code>RuleGroupId</code> of the <code>RuleGroup</code> for which you want <code>GetSampledRequests</code> to return a sample of requests.</p> </li> <li> <p> <code>Default_Action</code>, which causes <code>GetSampledRequests</code> to return a sample of the requests that didn't match any of the rules in the specified <code>WebACL</code>.</p> </li> </ul>
MaxItemsinteger required

The number of requests that you want AWS WAF to return from among the first 5,000 requests that your AWS resource received during the time range. If your resource received fewer requests than the value of <code>MaxItems</code>, <code>GetSampledRequests</code> returns information about all of them.

Response

Success

PopulationSizeinteger

The total number of requests from which <code>GetSampledRequests</code> got a sample of <code>MaxItems</code> requests. If <code>PopulationSize</code> is less than <code>MaxItems</code>, the sample includes every request that your AWS resource received during the specified time range.

Example response

{
  "PopulationSize": 50,
  "SampledRequests": [
    {
      "Action": "BLOCK",
      "Request": {
        "ClientIP": "192.0.2.44",
        "Country": "US",
        "HTTPVersion": "HTTP/1.1",
        "Headers": [
          {
            "Name": "User-Agent",
            "Value": "BadBot "
          }
        ],
        "Method": "HEAD"
      },
      "Timestamp": "2016-09-27T14:55Z",
      "Weight": 1
    }
  ],
  "TimeWindow": {
    "EndTime": "2016-09-27T15:50Z",
    "StartTime": "2016-09-27T14:50Z"
  }
}