Amazon QuickSight Java SDK - Amazon QuickSight

Amazon QuickSight Java SDK

Use the following procedure to set up a Java app that interacts with Amazon QuickSight.

  1. To get started, create a Java project in your IDE.

  2. Import the Amazon QuickSight SDK into your new project, for example: AWSQuickSightJavaClient-1.11.x.jar

  3. Once your IDE indexes the Amazon QuickSight SDK, you should be able to add an import line as follows:

    import com.amazonaws.services.quicksight.AmazonQuickSight;

    If you IDE doesn't recognize this as valid, verify that you imported the SDK.

  4. Like other AWS SDKs, Amazon QuickSight SDK requires external dependencies to perform many of its functions. You need to download and import those into the same project. The following dependencies are required:

  5. Now, you are ready to create an Amazon QuickSight client. You can use a default public endpoint that the client can communicate with or you can reference the endpoint explicitly. There are multiple ways to provide your AWS credentials. In the following example, we provide a direct, simple approach. The following client method is used to make all the API calls that follow:

    private static AmazonQuickSight getClient() { final AWSCredentialsProvider credsProvider = new AWSCredentialsProvider() { @Override public AWSCredentials getCredentials() { // provide actual IAM access key and secret key here return new BasicAWSCredentials("access-key", "secret-key"); } @Override public void refresh() {} }; return AmazonQuickSightClientBuilder .standard() .withRegion(Regions.US_EAST_1.getName()) .withCredentials(credsProvider) .build(); }
  6. Now, we can use the above client to list all the users in our Amazon QuickSight account.

    Note

    You have to provide the AWS account ID that you used to subscribe to Amazon QuickSight. This must match the AWS account ID of the caller’s identity. Cross-account calls aren't supported at this time. Furthermore, the required parameter namespace should always be set to default.

    getClient().listUsers(new ListUsersRequest() .withAwsAccountId("relevant_AWS_account_ID") .withNamespace("default")) .getUserList().forEach(user -> { System.out.println(user.getArn()); });
  7. To see a list of all possible API operations and the request objects they use, you can CTRL-click on the client object in your IDE in order to view the Amazon QuickSight interface. Alternatively, find it within the com.amazonaws.services.quicksight package in the Amazon QuickSight JavaClient JAR file.