Skip to content
v2.276.0

URLEncodingFormat Enum ​

The style used when applying URL encoding to array values.

Example ​

ts
import * as events from 'aws-cdk-lib/aws-events';

const connection = new events.Connection(this, 'Connection', {
  authorization: events.Authorization.basic('username', SecretValue.unsafePlainText('password')),
});

new tasks.HttpInvoke(this, 'Invoke HTTP API', {
  apiRoot: 'https://api.example.com',
  apiEndpoint: sfn.TaskInput.fromText(sfn.JsonPath.format('resource/{}/details', sfn.JsonPath.stringAt('$.resourceId'))),
  body: sfn.TaskInput.fromObject({ foo: 'bar' }),
  connection,
  headers: sfn.TaskInput.fromObject({ 'Content-Type': 'application/json' }),
  method: sfn.TaskInput.fromText('POST'),
  queryStringParameters: sfn.TaskInput.fromObject({ id: '123' }),
  urlEncodingFormat: tasks.URLEncodingFormat.BRACKETS,
});
python
import aws_cdk.aws_events as events


connection = events.Connection(self, "Connection",
    authorization=events.Authorization.basic("username", SecretValue.unsafe_plain_text("password"))
)

tasks.HttpInvoke(self, "Invoke HTTP API",
    api_root="https://api.example.com",
    api_endpoint=sfn.TaskInput.from_text(sfn.JsonPath.format("resource/{}/details", sfn.JsonPath.string_at("$.resourceId"))),
    body=sfn.TaskInput.from_object({"foo": "bar"}),
    connection=connection,
    headers=sfn.TaskInput.from_object({"Content-Type": "application/json"}),
    method=sfn.TaskInput.from_text("POST"),
    query_string_parameters=sfn.TaskInput.from_object({"id": "123"}),
    url_encoding_format=tasks.URLEncodingFormat.BRACKETS
)
java
import software.amazon.awscdk.services.events.*;


Connection connection = Connection.Builder.create(this, "Connection")
        .authorization(Authorization.basic("username", SecretValue.unsafePlainText("password")))
        .build();

HttpInvoke.Builder.create(this, "Invoke HTTP API")
        .apiRoot("https://api.example.com")
        .apiEndpoint(TaskInput.fromText(JsonPath.format("resource/{}/details", JsonPath.stringAt("$.resourceId"))))
        .body(TaskInput.fromObject(Map.of("foo", "bar")))
        .connection(connection)
        .headers(TaskInput.fromObject(Map.of("Content-Type", "application/json")))
        .method(TaskInput.fromText("POST"))
        .queryStringParameters(TaskInput.fromObject(Map.of("id", "123")))
        .urlEncodingFormat(URLEncodingFormat.BRACKETS)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.Events;


var connection = new Connection(this, "Connection", new ConnectionProps {
    Authorization = Authorization.Basic("username", SecretValue.UnsafePlainText("password"))
});

new HttpInvoke(this, "Invoke HTTP API", new HttpInvokeProps {
    ApiRoot = "https://api.example.com",
    ApiEndpoint = TaskInput.FromText(JsonPath.Format("resource/{}/details", JsonPath.StringAt("$.resourceId"))),
    Body = TaskInput.FromObject(new Dictionary<string, object> { { "foo", "bar" } }),
    Connection = connection,
    Headers = TaskInput.FromObject(new Dictionary<string, object> { { "Content-Type", "application/json" } }),
    Method = TaskInput.FromText("POST"),
    QueryStringParameters = TaskInput.FromObject(new Dictionary<string, object> { { "id", "123" } }),
    UrlEncodingFormat = URLEncodingFormat.BRACKETS
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/aws/aws-cdk-go/awscdk"


connection := events.NewConnection(this, jsii.String("Connection"), &ConnectionProps{
	Authorization: events.Authorization_Basic(jsii.String("username"), awscdk.SecretValue_UnsafePlainText(jsii.String("password"))),
})

tasks.NewHttpInvoke(this, jsii.String("Invoke HTTP API"), &HttpInvokeProps{
	ApiRoot: jsii.String("https://api.example.com"),
	ApiEndpoint: sfn.TaskInput_FromText(sfn.JsonPath_Format(jsii.String("resource/{}/details"), sfn.JsonPath_StringAt(jsii.String("$.resourceId")))),
	Body: sfn.TaskInput_FromObject(map[string]interface{}{
		"foo": jsii.String("bar"),
	}),
	Connection: Connection,
	Headers: sfn.TaskInput_*FromObject(map[string]interface{}{
		"Content-Type": jsii.String("application/json"),
	}),
	Method: sfn.TaskInput_*FromText(jsii.String("POST")),
	QueryStringParameters: sfn.TaskInput_*FromObject(map[string]interface{}{
		"id": jsii.String("123"),
	}),
	UrlEncodingFormat: tasks.URLEncodingFormat_BRACKETS,
})

Members ​

MemberDescription
BRACKETSEncode arrays using brackets.
COMMASEncode arrays using commas.
DEFAULTApply the default URL encoding style (INDICES).
INDICESEncode arrays using the index value.
NONEDo not apply URL encoding.
REPEATRepeat key for each item in the array.

Referenced by ​

  • HttpInvokeJsonataProps.urlEncodingFormaturl_encoding_formaturlEncodingFormatUrlEncodingFormatUrlEncodingFormat
  • HttpInvokeJsonPathProps.urlEncodingFormaturl_encoding_formaturlEncodingFormatUrlEncodingFormatUrlEncodingFormat
  • HttpInvokeProps.urlEncodingFormaturl_encoding_formaturlEncodingFormatUrlEncodingFormatUrlEncodingFormat