CheckCapacity unicodeC Example
#include <C_CkRestW.h>
#include <C_CkAuthAwsW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkStringBuilderW.h>
void ChilkatSample(void)
{
HCkRestW rest;
BOOL success;
HCkAuthAwsW authAws;
HCkJsonObjectW json;
HCkStringBuilderW sbRequestBody;
HCkStringBuilderW sbResponseBody;
int respStatusCode;
HCkJsonObjectW jResp;
int Capacity;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
rest = CkRestW_Create();
authAws = CkAuthAwsW_Create();
CkAuthAwsW_putAccessKey(authAws,L"AWS_ACCESS_KEY");
CkAuthAwsW_putSecretKey(authAws,L"AWS_SECRET_KEY");
// Don't forget to change the region to your particular region. (Also make the same change in the call to Connect below.)
CkAuthAwsW_putRegion(authAws,L"us-west-2");
CkAuthAwsW_putServiceName(authAws,L"wafv2");
// SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
CkRestW_SetAuthAws(rest,authAws);
// URL: https://wafv2.us-west-2.amazonaws.com/
// Use the same region as specified above.
success = CkRestW_Connect(rest,L"wafv2.us-west-2.amazonaws.com",443,TRUE,TRUE);
if (success != TRUE) {
wprintf(L"ConnectFailReason: %d\n",CkRestW_getConnectFailReason(rest));
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkRestW_Dispose(rest);
CkAuthAwsW_Dispose(authAws);
return;
}
// The following code creates the JSON request body.
// The JSON created by this code is shown below.
// Use this online tool to generate code from sample JSON:
// Generate Code to Create JSON
json = CkJsonObjectW_Create();
CkJsonObjectW_UpdateString(json,L"Rules[0].Action.Allow.CustomRequestHandling.InsertHeaders[0].Name",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Action.Allow.CustomRequestHandling.InsertHeaders[0].Value",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Action.Block.CustomResponse.CustomResponseBodyKey",L"string");
CkJsonObjectW_UpdateInt(json,L"Rules[0].Action.Block.CustomResponse.ResponseCode",123);
CkJsonObjectW_UpdateString(json,L"Rules[0].Action.Block.CustomResponse.ResponseHeaders[0].Name",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Action.Block.CustomResponse.ResponseHeaders[0].Value",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Action.Captcha.CustomRequestHandling.InsertHeaders[0].Name",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Action.Captcha.CustomRequestHandling.InsertHeaders[0].Value",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Action.Count.CustomRequestHandling.InsertHeaders[0].Name",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Action.Count.CustomRequestHandling.InsertHeaders[0].Value",L"string");
CkJsonObjectW_UpdateInt(json,L"Rules[0].CaptchaConfig.ImmunityTimeProperty.ImmunityTime",123);
CkJsonObjectW_UpdateString(json,L"Rules[0].Name",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].OverrideAction.Count.CustomRequestHandling.InsertHeaders[0].Name",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].OverrideAction.Count.CustomRequestHandling.InsertHeaders[0].Value",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].OverrideAction.None");
CkJsonObjectW_UpdateInt(json,L"Rules[0].Priority",123);
CkJsonObjectW_UpdateString(json,L"Rules[0].RuleLabels[0].Name",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.AndStatement.Statements[0]",L"Statement");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.AllQueryArguments");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Body.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Cookies.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Cookies.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Cookies.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Headers.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Headers.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Headers.OversizeHandling",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.JsonBody.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.JsonBody.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.JsonBody.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.Method");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.QueryString");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.SingleHeader.Name",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.SingleQueryArgument.Name",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.ByteMatchStatement.FieldToMatch.UriPath");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ByteMatchStatement.PositionalConstraint",L"string");
CkJsonObjectW_UpdateInt(json,L"Rules[0].Statement.ByteMatchStatement.SearchString",123);
CkJsonObjectW_UpdateInt(json,L"Rules[0].Statement.ByteMatchStatement.TextTransformations[0].Priority",123);
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ByteMatchStatement.TextTransformations[0].Type",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.GeoMatchStatement.CountryCodes[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.GeoMatchStatement.ForwardedIPConfig.FallbackBehavior",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.GeoMatchStatement.ForwardedIPConfig.HeaderName",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.IPSetReferenceStatement.ARN",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.IPSetReferenceStatement.IPSetForwardedIPConfig.FallbackBehavior",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.IPSetReferenceStatement.IPSetForwardedIPConfig.HeaderName",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.IPSetReferenceStatement.IPSetForwardedIPConfig.Position",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.LabelMatchStatement.Key",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.LabelMatchStatement.Scope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ManagedRuleGroupStatement.ExcludedRules[0].Name",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ManagedRuleGroupStatement.ManagedRuleGroupConfigs[0].LoginPath",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ManagedRuleGroupStatement.ManagedRuleGroupConfigs[0].PasswordField.Identifier",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ManagedRuleGroupStatement.ManagedRuleGroupConfigs[0].PayloadType",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ManagedRuleGroupStatement.ManagedRuleGroupConfigs[0].UsernameField.Identifier",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ManagedRuleGroupStatement.Name",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ManagedRuleGroupStatement.ScopeDownStatement",L"Statement");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ManagedRuleGroupStatement.VendorName",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.ManagedRuleGroupStatement.Version",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.NotStatement.Statement",L"Statement");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.OrStatement.Statements[0]",L"Statement");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RateBasedStatement.AggregateKeyType",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RateBasedStatement.ForwardedIPConfig.FallbackBehavior",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RateBasedStatement.ForwardedIPConfig.HeaderName",L"string");
CkJsonObjectW_UpdateInt(json,L"Rules[0].Statement.RateBasedStatement.Limit",123);
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RateBasedStatement.ScopeDownStatement",L"Statement");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.AllQueryArguments");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Body.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Cookies.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Cookies.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Cookies.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Headers.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Headers.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Headers.OversizeHandling",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.JsonBody.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.JsonBody.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.JsonBody.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.Method");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.QueryString");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.SingleHeader.Name",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.SingleQueryArgument.Name",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.RegexMatchStatement.FieldToMatch.UriPath");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexMatchStatement.RegexString",L"string");
CkJsonObjectW_UpdateInt(json,L"Rules[0].Statement.RegexMatchStatement.TextTransformations[0].Priority",123);
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexMatchStatement.TextTransformations[0].Type",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.ARN",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.AllQueryArguments");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Body.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Cookies.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Cookies.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Cookies.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Headers.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Headers.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Headers.OversizeHandling",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.JsonBody.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.JsonBody.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.JsonBody.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.Method");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.QueryString");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.SingleHeader.Name",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.SingleQueryArgument.Name",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.FieldToMatch.UriPath");
CkJsonObjectW_UpdateInt(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.TextTransformations[0].Priority",123);
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RegexPatternSetReferenceStatement.TextTransformations[0].Type",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RuleGroupReferenceStatement.ARN",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.RuleGroupReferenceStatement.ExcludedRules[0].Name",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SizeConstraintStatement.ComparisonOperator",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.AllQueryArguments");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Body.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Cookies.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Cookies.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Cookies.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Headers.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Headers.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Headers.OversizeHandling",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.JsonBody.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.JsonBody.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.JsonBody.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.Method");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.QueryString");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.SingleHeader.Name",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.SingleQueryArgument.Name",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.SizeConstraintStatement.FieldToMatch.UriPath");
CkJsonObjectW_UpdateInt(json,L"Rules[0].Statement.SizeConstraintStatement.Size",123);
CkJsonObjectW_UpdateInt(json,L"Rules[0].Statement.SizeConstraintStatement.TextTransformations[0].Priority",123);
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SizeConstraintStatement.TextTransformations[0].Type",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.AllQueryArguments");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Body.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Cookies.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Cookies.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Cookies.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Headers.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Headers.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Headers.OversizeHandling",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.JsonBody.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.JsonBody.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.JsonBody.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.Method");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.QueryString");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.SingleHeader.Name",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.SingleQueryArgument.Name",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.SqliMatchStatement.FieldToMatch.UriPath");
CkJsonObjectW_UpdateInt(json,L"Rules[0].Statement.SqliMatchStatement.TextTransformations[0].Priority",123);
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.SqliMatchStatement.TextTransformations[0].Type",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.AllQueryArguments");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.Body.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.Cookies.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.Cookies.MatchPattern.ExcludedCookies[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.Cookies.MatchPattern.IncludedCookies[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.Cookies.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.Cookies.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.Headers.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.Headers.MatchPattern.ExcludedHeaders[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.Headers.MatchPattern.IncludedHeaders[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.Headers.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.Headers.OversizeHandling",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.JsonBody.InvalidFallbackBehavior",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.JsonBody.MatchPattern.All");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.JsonBody.MatchPattern.IncludedPaths[0]",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.JsonBody.MatchScope",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.JsonBody.OversizeHandling",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.Method");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.QueryString");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.SingleHeader.Name",L"string");
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.SingleQueryArgument.Name",L"string");
CkJsonObjectW_UpdateNewObject(json,L"Rules[0].Statement.XssMatchStatement.FieldToMatch.UriPath");
CkJsonObjectW_UpdateInt(json,L"Rules[0].Statement.XssMatchStatement.TextTransformations[0].Priority",123);
CkJsonObjectW_UpdateString(json,L"Rules[0].Statement.XssMatchStatement.TextTransformations[0].Type",L"string");
CkJsonObjectW_UpdateInt(json,L"Rules[0].VisibilityConfig.CloudWatchMetricsEnabled",123);
CkJsonObjectW_UpdateString(json,L"Rules[0].VisibilityConfig.MetricName",L"string");
CkJsonObjectW_UpdateInt(json,L"Rules[0].VisibilityConfig.SampledRequestsEnabled",123);
CkJsonObjectW_UpdateString(json,L"Scope",L"string");
// The JSON request body created by the above code:
// {
// "Rules": [
// {
// "Action": {
// "Allow": {
// "CustomRequestHandling": {
// "InsertHeaders": [
// {
// "Name": "string",
// "Value": "string"
// }
// ]
// }
// },
// "Block": {
// "CustomResponse": {
// "CustomResponseBodyKey": "string",
// "ResponseCode": number,
// "ResponseHeaders": [
// {
// "Name": "string",
// "Value": "string"
// }
// ]
// }
// },
// "Captcha": {
// "CustomRequestHandling": {
// "InsertHeaders": [
// {
// "Name": "string",
// "Value": "string"
// }
// ]
// }
// },
// "Count": {
// "CustomRequestHandling": {
// "InsertHeaders": [
// {
// "Name": "string",
// "Value": "string"
// }
// ]
// }
// }
// },
// "CaptchaConfig": {
// "ImmunityTimeProperty": {
// "ImmunityTime": number
// }
// },
// "Name": "string",
// "OverrideAction": {
// "Count": {
// "CustomRequestHandling": {
// "InsertHeaders": [
// {
// "Name": "string",
// "Value": "string"
// }
// ]
// }
// },
// "None": {}
// },
// "Priority": number,
// "RuleLabels": [
// {
// "Name": "string"
// }
// ],
// "Statement": {
// "AndStatement": {
// "Statements": [
// "Statement"
// ]
// },
// "ByteMatchStatement": {
// "FieldToMatch": {
// "AllQueryArguments": {},
// "Body": {
// "OversizeHandling": "string"
// },
// "Cookies": {
// "MatchPattern": {
// "All": {},
// "ExcludedCookies": [
// "string"
// ],
// "IncludedCookies": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "Headers": {
// "MatchPattern": {
// "All": {},
// "ExcludedHeaders": [
// "string"
// ],
// "IncludedHeaders": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "JsonBody": {
// "InvalidFallbackBehavior": "string",
// "MatchPattern": {
// "All": {},
// "IncludedPaths": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "Method": {},
// "QueryString": {},
// "SingleHeader": {
// "Name": "string"
// },
// "SingleQueryArgument": {
// "Name": "string"
// },
// "UriPath": {}
// },
// "PositionalConstraint": "string",
// "SearchString": blob,
// "TextTransformations": [
// {
// "Priority": number,
// "Type": "string"
// }
// ]
// },
// "GeoMatchStatement": {
// "CountryCodes": [
// "string"
// ],
// "ForwardedIPConfig": {
// "FallbackBehavior": "string",
// "HeaderName": "string"
// }
// },
// "IPSetReferenceStatement": {
// "ARN": "string",
// "IPSetForwardedIPConfig": {
// "FallbackBehavior": "string",
// "HeaderName": "string",
// "Position": "string"
// }
// },
// "LabelMatchStatement": {
// "Key": "string",
// "Scope": "string"
// },
// "ManagedRuleGroupStatement": {
// "ExcludedRules": [
// {
// "Name": "string"
// }
// ],
// "ManagedRuleGroupConfigs": [
// {
// "LoginPath": "string",
// "PasswordField": {
// "Identifier": "string"
// },
// "PayloadType": "string",
// "UsernameField": {
// "Identifier": "string"
// }
// }
// ],
// "Name": "string",
// "ScopeDownStatement": "Statement",
// "VendorName": "string",
// "Version": "string"
// },
// "NotStatement": {
// "Statement": "Statement"
// },
// "OrStatement": {
// "Statements": [
// "Statement"
// ]
// },
// "RateBasedStatement": {
// "AggregateKeyType": "string",
// "ForwardedIPConfig": {
// "FallbackBehavior": "string",
// "HeaderName": "string"
// },
// "Limit": number,
// "ScopeDownStatement": "Statement"
// },
// "RegexMatchStatement": {
// "FieldToMatch": {
// "AllQueryArguments": {},
// "Body": {
// "OversizeHandling": "string"
// },
// "Cookies": {
// "MatchPattern": {
// "All": {},
// "ExcludedCookies": [
// "string"
// ],
// "IncludedCookies": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "Headers": {
// "MatchPattern": {
// "All": {},
// "ExcludedHeaders": [
// "string"
// ],
// "IncludedHeaders": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "JsonBody": {
// "InvalidFallbackBehavior": "string",
// "MatchPattern": {
// "All": {},
// "IncludedPaths": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "Method": {},
// "QueryString": {},
// "SingleHeader": {
// "Name": "string"
// },
// "SingleQueryArgument": {
// "Name": "string"
// },
// "UriPath": {}
// },
// "RegexString": "string",
// "TextTransformations": [
// {
// "Priority": number,
// "Type": "string"
// }
// ]
// },
// "RegexPatternSetReferenceStatement": {
// "ARN": "string",
// "FieldToMatch": {
// "AllQueryArguments": {},
// "Body": {
// "OversizeHandling": "string"
// },
// "Cookies": {
// "MatchPattern": {
// "All": {},
// "ExcludedCookies": [
// "string"
// ],
// "IncludedCookies": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "Headers": {
// "MatchPattern": {
// "All": {},
// "ExcludedHeaders": [
// "string"
// ],
// "IncludedHeaders": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "JsonBody": {
// "InvalidFallbackBehavior": "string",
// "MatchPattern": {
// "All": {},
// "IncludedPaths": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "Method": {},
// "QueryString": {},
// "SingleHeader": {
// "Name": "string"
// },
// "SingleQueryArgument": {
// "Name": "string"
// },
// "UriPath": {}
// },
// "TextTransformations": [
// {
// "Priority": number,
// "Type": "string"
// }
// ]
// },
// "RuleGroupReferenceStatement": {
// "ARN": "string",
// "ExcludedRules": [
// {
// "Name": "string"
// }
// ]
// },
// "SizeConstraintStatement": {
// "ComparisonOperator": "string",
// "FieldToMatch": {
// "AllQueryArguments": {},
// "Body": {
// "OversizeHandling": "string"
// },
// "Cookies": {
// "MatchPattern": {
// "All": {},
// "ExcludedCookies": [
// "string"
// ],
// "IncludedCookies": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "Headers": {
// "MatchPattern": {
// "All": {},
// "ExcludedHeaders": [
// "string"
// ],
// "IncludedHeaders": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "JsonBody": {
// "InvalidFallbackBehavior": "string",
// "MatchPattern": {
// "All": {},
// "IncludedPaths": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "Method": {},
// "QueryString": {},
// "SingleHeader": {
// "Name": "string"
// },
// "SingleQueryArgument": {
// "Name": "string"
// },
// "UriPath": {}
// },
// "Size": number,
// "TextTransformations": [
// {
// "Priority": number,
// "Type": "string"
// }
// ]
// },
// "SqliMatchStatement": {
// "FieldToMatch": {
// "AllQueryArguments": {},
// "Body": {
// "OversizeHandling": "string"
// },
// "Cookies": {
// "MatchPattern": {
// "All": {},
// "ExcludedCookies": [
// "string"
// ],
// "IncludedCookies": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "Headers": {
// "MatchPattern": {
// "All": {},
// "ExcludedHeaders": [
// "string"
// ],
// "IncludedHeaders": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "JsonBody": {
// "InvalidFallbackBehavior": "string",
// "MatchPattern": {
// "All": {},
// "IncludedPaths": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "Method": {},
// "QueryString": {},
// "SingleHeader": {
// "Name": "string"
// },
// "SingleQueryArgument": {
// "Name": "string"
// },
// "UriPath": {}
// },
// "TextTransformations": [
// {
// "Priority": number,
// "Type": "string"
// }
// ]
// },
// "XssMatchStatement": {
// "FieldToMatch": {
// "AllQueryArguments": {},
// "Body": {
// "OversizeHandling": "string"
// },
// "Cookies": {
// "MatchPattern": {
// "All": {},
// "ExcludedCookies": [
// "string"
// ],
// "IncludedCookies": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "Headers": {
// "MatchPattern": {
// "All": {},
// "ExcludedHeaders": [
// "string"
// ],
// "IncludedHeaders": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "JsonBody": {
// "InvalidFallbackBehavior": "string",
// "MatchPattern": {
// "All": {},
// "IncludedPaths": [
// "string"
// ]
// },
// "MatchScope": "string",
// "OversizeHandling": "string"
// },
// "Method": {},
// "QueryString": {},
// "SingleHeader": {
// "Name": "string"
// },
// "SingleQueryArgument": {
// "Name": "string"
// },
// "UriPath": {}
// },
// "TextTransformations": [
// {
// "Priority": number,
// "Type": "string"
// }
// ]
// }
// },
// "VisibilityConfig": {
// "CloudWatchMetricsEnabled": boolean,
// "MetricName": "string",
// "SampledRequestsEnabled": boolean
// }
// }
// ],
// "Scope": "string"
// }
CkRestW_AddHeader(rest,L"Content-Type",L"application/x-amz-json-1.1");
CkRestW_AddHeader(rest,L"X-Amz-Target",L"AWSWAF_20190729.CheckCapacity");
sbRequestBody = CkStringBuilderW_Create();
CkJsonObjectW_EmitSb(json,sbRequestBody);
sbResponseBody = CkStringBuilderW_Create();
success = CkRestW_FullRequestSb(rest,L"POST",L"/",sbRequestBody,sbResponseBody);
if (success != TRUE) {
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkRestW_Dispose(rest);
CkAuthAwsW_Dispose(authAws);
CkJsonObjectW_Dispose(json);
CkStringBuilderW_Dispose(sbRequestBody);
CkStringBuilderW_Dispose(sbResponseBody);
return;
}
respStatusCode = CkRestW_getResponseStatusCode(rest);
wprintf(L"response status code = %d\n",respStatusCode);
if (respStatusCode != 200) {
wprintf(L"Response Header:\n");
wprintf(L"%s\n",CkRestW_responseHeader(rest));
wprintf(L"Response Body:\n");
wprintf(L"%s\n",CkStringBuilderW_getAsString(sbResponseBody));
CkRestW_Dispose(rest);
CkAuthAwsW_Dispose(authAws);
CkJsonObjectW_Dispose(json);
CkStringBuilderW_Dispose(sbRequestBody);
CkStringBuilderW_Dispose(sbResponseBody);
return;
}
jResp = CkJsonObjectW_Create();
CkJsonObjectW_LoadSb(jResp,sbResponseBody);
// The following code parses the JSON response.
// A sample JSON response is shown below the sample code.
// Use this online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
// Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.
// See this example explaining how this memory should be used: const char * functions.
Capacity = CkJsonObjectW_IntOf(jResp,L"Capacity");
// A sample JSON response body parsed by the above code:
// {
// "Capacity": number
// }
CkRestW_Dispose(rest);
CkAuthAwsW_Dispose(authAws);
CkJsonObjectW_Dispose(json);
CkStringBuilderW_Dispose(sbRequestBody);
CkStringBuilderW_Dispose(sbResponseBody);
CkJsonObjectW_Dispose(jResp);
}