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
| Member | Description |
|---|---|
BRACKETS | Encode arrays using brackets. |
COMMAS | Encode arrays using commas. |
DEFAULT | Apply the default URL encoding style (INDICES). |
INDICES | Encode arrays using the index value. |
NONE | Do not apply URL encoding. |
REPEAT | Repeat key for each item in the array. |
Referenced by
HttpInvokeJsonataProps.urlEncodingFormaturl_encoding_formaturlEncodingFormatUrlEncodingFormatUrlEncodingFormatHttpInvokeJsonPathProps.urlEncodingFormaturl_encoding_formaturlEncodingFormatUrlEncodingFormatUrlEncodingFormatHttpInvokeProps.urlEncodingFormaturl_encoding_formaturlEncodingFormatUrlEncodingFormatUrlEncodingFormat