Quicksight Boto3 APIs for CreateTemplate

Hi Team,
I am trying to create an analysis using template definition
For the same, I am writing this code

template_new = client_dest.create_template(AwsAccountId = accountid, Name = name, Definition = d,TemplateId = ‘1234’)

I have stored the template definition in a variable ‘d’, the structure is same as mentioned here

While running this, I am getting this error

InvalidParameterValueException: An error occurred (InvalidParameterValueException) when calling the CreateTemplate operation: The DataSetIdentifier BL86495 Test used is invalid

I can see the parameter ‘DataSetIdentifier’ in the key of ‘Sheets’ for Definition that I have uploaded. There, the value for the same if ‘BL86495 Test’

Here, BL86495 Test is the name of my dataset that I have associated in the analysis.
Can someone help me understand how the DataSetIdentifier is supposed to be declared, as per the documentation mentioned above? Is it supposed to be the dataset name, or some ID or in some other way?

I would request for some documentation that has reference syntax as the documentation provided on multiple AWS pages are without any reference syntax and is very difficult to follow

Warm Regards
Sahil Sondhi

@Sahil this is how you can create the template…
with the information you are passing, there is no way AWS can create a template. you can only create a template from the analysis, and then use that template to launch different dashboards.
here is the sample boto3 call look like.

client.create_template(
    AwsAccountId="{acc_id}",
    TemplateId="I_AM_QS_Template_1",
    Name="I_AM_QS_Template_1",
    SourceEntity={
    'SourceAnalysis': {
        'Arn': "arn:aws:quicksight:{region}:{acc_id}:analysis/{analyses_id}",
        'DataSetReferences': [
            {'DataSetPlaceholder' : 'Name1' , 'DataSetArn': 'arn:aws:quicksight:...'},
            {'DataSetPlaceholder' : 'Name2' , 'DataSetArn': 'arn:aws:quicksight:...'},
            ...
        ]
    }
},
    VersionDescription='V 1 whatever'
)
1 Like

Hi @Sahil, did this solution work for you? I am marking this reply as, “Solution,” but let us know if this is not resolved. Thanks for posting your questions on the Quick Sight Community!