终止支持通知:AWS 将于 2026 年 10 月 30 日终止对 Amazon Pinpoint 的支持。2026 年 10 月 30 日之后,您将不再能够访问 Amazon Pinpoint 控制台或 Amazon Pinpoint 资源(端点、客户细分、营销活动、旅程和分析)。有关更多信息,请参阅 Amazon Pinpoint 终止支持。注意:与短信、语音、移动推送、OTP 和电话号码验证相关的 API 不受此变更的影响,AWS End User Messaging 支持这些功能。
将 CreateApp 与 AWS SDK 或 CLI 配合使用
以下代码示例演示如何使用 CreateApp。
- CLI
-
- AWS CLI
-
示例 1:创建应用程序
以下
create-app示例创建一个新的应用程序(项目)。aws pinpoint create-app \ --create-application-requestName=ExampleCorp输出:
{ "ApplicationResponse": { "Arn": "arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example", "Id": "810c7aab86d42fb2b56c8c966example", "Name": "ExampleCorp", "tags": {} } }示例 2:创建带有标签的应用程序
以下
create-app示例创建一个新的应用程序(项目),并将标签(键和值)与该应用程序关联。aws pinpoint create-app \ --create-application-request Name=ExampleCorp,tags={"Stack"="Test"}输出:
{ "ApplicationResponse": { "Arn": "arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example", "Id": "810c7aab86d42fb2b56c8c966example", "Name": "ExampleCorp", "tags": { "Stack": "Test" } } }-
有关 API 详细信息,请参阅《AWS CLI 命令参考》中的 CreateApp
。
-
- Java
-
- 适用于 Java 的 SDK 2.x
-
注意
查看 GitHub,了解更多信息。在 AWS 代码示例存储库
中查找完整示例,了解如何进行设置和运行。 import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.pinpoint.PinpointClient; import software.amazon.awssdk.services.pinpoint.model.CreateAppRequest; import software.amazon.awssdk.services.pinpoint.model.CreateAppResponse; import software.amazon.awssdk.services.pinpoint.model.CreateApplicationRequest; import software.amazon.awssdk.services.pinpoint.model.PinpointException; /** * Before running this Java V2 code example, set up your development * environment, including your credentials. * * For more information, see the following documentation topic: * * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html */ public class CreateApp { public static void main(String[] args) { final String usage = """ Usage: <appName> Where: appName - The name of the application to create. """; if (args.length != 1) { System.out.println(usage); System.exit(1); } String appName = args[0]; System.out.println("Creating an application with name: " + appName); PinpointClient pinpoint = PinpointClient.builder() .region(Region.US_EAST_1) .build(); String appID = createApplication(pinpoint, appName); System.out.println("App ID is: " + appID); pinpoint.close(); } public static String createApplication(PinpointClient pinpoint, String appName) { try { CreateApplicationRequest appRequest = CreateApplicationRequest.builder() .name(appName) .build(); CreateAppRequest request = CreateAppRequest.builder() .createApplicationRequest(appRequest) .build(); CreateAppResponse result = pinpoint.createApp(request); return result.applicationResponse().id(); } catch (PinpointException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } return ""; } }-
有关 API 详细信息,请参阅《AWS SDK for Java 2.x API 参考》中的 CreateApp。
-
- Kotlin
-
- SDK for Kotlin
-
注意
查看 GitHub,了解更多信息。在 AWS 代码示例存储库
中查找完整示例,了解如何进行设置和运行。 suspend fun createApplication(applicationName: String?): String? { val createApplicationRequestOb = CreateApplicationRequest { name = applicationName } PinpointClient.fromEnvironment { region = "us-west-2" }.use { pinpoint -> val result = pinpoint.createApp( CreateAppRequest { createApplicationRequest = createApplicationRequestOb }, ) return result.applicationResponse?.id } }-
有关 API 详细信息,请参阅《AWS SDK for Kotlin API 参考》中的 CreateApp
。
-
有关 AWS SDK 开发人员指南和代码示例的完整列表,请参阅 通过 AWS SDK 使用 Amazon Pinpoint。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。
操作
CreateCampaign