既存の Amazon Pinpoint エンドポイントに関する情報を表示する - AWS SDK コードサンプル

Doc AWS SDK Examples リポジトリには、他にも SDK の例があります。 AWS GitHub

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

既存の Amazon Pinpoint エンドポイントに関する情報を表示する

次のコード例は、エンドポイントを取得する方法を示しています。

CLI
AWS CLI

アプリケーションの特定のエンドポイントの設定と属性に関する情報を取得するには

次の get-endpoint 例では、アプリケーションの特定のエンドポイントに関する設定と属性の情報を取得します。

aws pinpoint get-endpoint \ --application-id 611e3e3cdd47474c9c1399a505665b91 \ --endpoint-id testendpoint \ --region us-east-1

出力:

{ "EndpointResponse": { "Address": "+11234567890", "ApplicationId": "611e3e3cdd47474c9c1399a505665b91", "Attributes": {}, "ChannelType": "SMS", "CohortId": "63", "CreationDate": "2019-01-28T23:55:11.534Z", "EffectiveDate": "2021-08-06T00:04:51.763Z", "EndpointStatus": "ACTIVE", "Id": "testendpoint", "Location": { "Country": "USA" }, "Metrics": { "SmsDelivered": 1.0 }, "OptOut": "ALL", "RequestId": "a204b1f2-7e26-48a7-9c80-b49a2143489d", "User": { "UserAttributes": { "Age": [ "24" ] }, "UserId": "testuser" } } }
  • API の詳細については、「 コマンドリファレンスGetEndpoint」の「」を参照してください。 AWS CLI

Java
SDK for Java 2.x
注記

には他にもがあります GitHub。用例一覧を検索し、AWS コードサンプルリポジトリでの設定と実行の方法を確認してください。

import com.google.gson.FieldNamingPolicy; import com.google.gson.Gson; import com.google.gson.GsonBuilder; 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.GetEndpointResponse; import software.amazon.awssdk.services.pinpoint.model.PinpointException; import software.amazon.awssdk.services.pinpoint.model.GetEndpointRequest; /** * 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 LookUpEndpoint { public static void main(String[] args) { final String usage = """ Usage: <appId> <endpoint> Where: appId - The ID of the application to delete. endpoint - The ID of the endpoint.\s """; if (args.length != 2) { System.out.println(usage); System.exit(1); } String appId = args[0]; String endpoint = args[1]; System.out.println("Looking up an endpoint point with ID: " + endpoint); PinpointClient pinpoint = PinpointClient.builder() .region(Region.US_EAST_1) .build(); lookupPinpointEndpoint(pinpoint, appId, endpoint); pinpoint.close(); } public static void lookupPinpointEndpoint(PinpointClient pinpoint, String appId, String endpoint) { try { GetEndpointRequest appRequest = GetEndpointRequest.builder() .applicationId(appId) .endpointId(endpoint) .build(); GetEndpointResponse result = pinpoint.getEndpoint(appRequest); EndpointResponse endResponse = result.endpointResponse(); // Uses the Google Gson library to pretty print the endpoint JSON. Gson gson = new GsonBuilder() .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE) .setPrettyPrinting() .create(); String endpointJson = gson.toJson(endResponse); System.out.println(endpointJson); } catch (PinpointException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } System.out.println("Done"); } }
  • API の詳細については、「 API リファレンスGetEndpoint」の「」を参照してください。 AWS SDK for Java 2.x

Kotlin
SDK for Kotlin
注記

には他にもがあります GitHub。用例一覧を検索し、AWS コードサンプルリポジトリでの設定と実行の方法を確認してください。

suspend fun lookupPinpointEndpoint(appId: String?, endpoint: String?) { PinpointClient { region = "us-west-2" }.use { pinpoint -> val result = pinpoint.getEndpoint( GetEndpointRequest { applicationId = appId endpointId = endpoint } ) val endResponse = result.endpointResponse // Uses the Google Gson library to pretty print the endpoint JSON. val gson: com.google.gson.Gson = GsonBuilder() .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE) .setPrettyPrinting() .create() val endpointJson: String = gson.toJson(endResponse) println(endpointJson) } }
  • API の詳細については、GetEndpointAWS「 SDK for Kotlin API リファレンス」の「」を参照してください。