Use ListCampaigns with an AWS SDK - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use ListCampaigns with an AWS SDK

The following code example shows how to use ListCampaigns.

Java
SDK for Java 2.x
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

public static void listAllCampaigns(PersonalizeClient personalizeClient, String solutionArn) { try { ListCampaignsRequest campaignsRequest = ListCampaignsRequest.builder() .maxResults(10) .solutionArn(solutionArn) .build(); ListCampaignsResponse response = personalizeClient.listCampaigns(campaignsRequest); List<CampaignSummary> campaigns = response.campaigns(); for (CampaignSummary campaign : campaigns) { System.out.println("Campaign name is : " + campaign.name()); System.out.println("Campaign ARN is : " + campaign.campaignArn()); } } catch (PersonalizeException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } }
  • For API details, see ListCampaigns in AWS SDK for Java 2.x API Reference.