支援終止通知:2026 年 10 月 30 日, AWS 將結束對 Amazon Pinpoint 的支援。2026 年 10 月 30 日之後,您將無法再存取 Amazon Pinpoint 主控台或 Amazon Pinpoint 資源 (端點、客群、行銷活動、旅程和分析)。如需詳細資訊,請參閱 Amazon Pinpoint 終止支援。注意:與 SMS、語音、行動推播、OTP 和電話號碼驗證相關的 APIs 不受此變更影響,並受 AWS 最終使用者傳訊支援。
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
使用 Amazon Pinpoint 列出端點 IDs
若要更新或刪除端點,您需要端點 ID。因此若要在 Amazon Pinpoint 專案的所有端點上執行這些操作,第一個步驟是列出屬於該專案的所有端點 ID。然後,您可以重複這些 ID 以便,例如,全域新增屬性或刪除您的專案中的所有端點。
下列範例使用 適用於 Java 的 AWS SDK 並執行下列動作:
-
從 Amazon Pinpoint 匯出端點中的範例程式碼呼叫範例
exportEndpointsToS3
方法。此方法會從 Amazon Pinpoint 專案匯出端點定義。端點定義會以 gzip 檔案形式加入 Amazon S3 儲存貯體。 -
下載匯出的 gzip 檔案。
-
讀取 gzip 檔案並從每個端點的 JSON 定義取得端點 ID。
-
列印端點 ID 至主控台。
-
刪除 Amazon Pinpoint 加到 Amazon S3 的檔案即可清理。
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;
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); } } }
如需完整的 SDK 範例,請參閱 GitHub