终止支持通知:AWS 将于 2026 年 10 月 30 日终止对 Amazon Pinpoint 的支持。2026 年 10 月 30 日之后,您将不再能够访问 Amazon Pinpoint 控制台或 Amazon Pinpoint 资源(端点、客户细分、营销活动、旅程和分析)。有关更多信息,请参阅 Amazon Pinpoint 终止支持。注意:与短信、语音、移动推送、OTP 和电话号码验证相关的 API 不受此变更的影响,AWS End User Messaging 支持这些功能。
将 GetUserEndpoints 和 AWS SDK 搭配使用
以下代码示例演示了如何使用 GetUserEndpoints。
- 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.EndpointResponse; import software.amazon.awssdk.services.pinpoint.model.GetUserEndpointsRequest; import software.amazon.awssdk.services.pinpoint.model.GetUserEndpointsResponse; import software.amazon.awssdk.services.pinpoint.model.PinpointException; import java.util.List; /** * 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 ListEndpointIds { public static void main(String[] args) { final String usage = """ Usage: <applicationId> <userId> Where: applicationId - The ID of the Amazon Pinpoint application that has the endpoint. userId - The user id applicable to the endpoints"""; if (args.length != 2) { System.out.println(usage); System.exit(1); } String applicationId = args[0]; String userId = args[1]; PinpointClient pinpoint = PinpointClient.builder() .region(Region.US_EAST_1) .build(); listAllEndpoints(pinpoint, applicationId, userId); pinpoint.close(); } public static void listAllEndpoints(PinpointClient pinpoint, String applicationId, String userId) { try { GetUserEndpointsRequest endpointsRequest = GetUserEndpointsRequest.builder() .userId(userId) .applicationId(applicationId) .build(); GetUserEndpointsResponse response = pinpoint.getUserEndpoints(endpointsRequest); List<EndpointResponse> endpoints = response.endpointsResponse().item(); // Display the results. for (EndpointResponse endpoint : endpoints) { System.out.println("The channel type is: " + endpoint.channelType()); System.out.println("The address is " + endpoint.address()); } } catch (PinpointException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } } }-
有关 API 详细信息,请参阅《AWS SDK for Java 2.x API 参考》中的 GetUserEndpoints。
-
有关 AWS SDK 开发人员指南和代码示例的完整列表,请参阅 通过 AWS SDK 使用 Amazon Pinpoint。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。
GetSmsChannel
SendMessages