Using API to create analysis

Hello,

I am trying to create an analysis usign the CLI API… I created the json file using:

aws quicksight describe-analysis-definition

then i tried to do
aws quicksight create analysis using the json file (after removing the resources status, Stauts and requested ID.

If I try to load it to the same account it says that the analysis already exist, so I tried to delete that and to lunch the command…no error but I do not see the analysis. this is the output

if I try to lunch again the comand it says that the analysis already exists…

what is happening?

Hi @remba87 - Can you please run the list_analyses to see whether the analysis is shown or not. I believe you have to give the permission to see the analysis in the UI. Please see the update analysis permission api details to set the permission. The document link is:

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/quicksight/client/update_analysis_permissions.html

Regards - Sanjeeb

it says STATUS: “CREATION_FAILED”

Hi @remba87 - Possibly this is the status of the 2nd run when you try to run it again. Can you please give the permission and see whether the analysis is visible to you or not. Or create an analysis with different name and see the status ( via list analysis) and give the permission.

Regards - Sanjeeb

I changed the name of the analysis and also the AnalysisId in the json file

then I launched the command and I have the status creatin in progrewss

then I see the list and the status for that ID is “Status”: “CREATION_FAILED”, but I did not get any errors…and I think this is why I do not see the analysis in my page

1 Like

Hi @remba87 - Yes, since the analysis creation is failed, that is why you are not able to see the analysis in the UI. You need to fix the error.

Is there any error displayed in the creation process.?

Hi @eperts - Any expert advise on this?

Regards - Sanjeeb

So I tried with another analysis…the one I was trying before was not directly created by me but it was shared by me so maybe that was the error…

now I tried with one created by me,
I changed the AnalysisId and name and lunched the command.

I do not see it in my analysis but I can see that the final status actually is “CREATION_SUCCESSFUL”, (using list-analyses)

@Sanjeeb2022 can you give me an example of the command I should use in the terminal to do what you suggesting please?

Hi @remba87 - Can you try update analysis by the below code. You need to change the details as per your account id, region, user details and analysis id.

See the documentation link - update-analysis-permissions — AWS CLI 2.1.21 Command Reference.

aws quicksight update-analysis-permissions 
    --aws-account-id 555555555555 
    --analysis-id ANALYSISID
    --grant-permissions Principal=arn:aws:quicksight:us-east-1:AWSACCOUNTID:user/default/USERNAME,Actions=quicksight:RestoreAnalysis,quicksight:UpdateAnalysisPermissions,quicksight:DeleteAnalysis,quicksight:QueryAnalysis,quicksight:DescribeAnalysisPermissions,quicksight:DescribeAnalysis,quicksight:UpdateAnalysis 

Regards - Sanjeeb

O thank you! I tried with a json file but it was not working and I could not understand why…now I can see the analysis!

I just noticed that
image

there is some problem of formatting in some visual…is it normal?

Hi @remba87 - If your JSONs are good, analysis should be created perfectly. Although I never tried CLI approach of creating analysis, but it should work. Can you take a very simple analysis and see whether you are facing some issues in analysis in terms of presentation ( like junk characters in analysis).

Hi @eperts - Any advise from you.

Regards - Sanjeeb

I did not change anything from the json file…

and then I am encountering other problems…
I am uploading an analysis made up of many sheets and datasets.

Is it possible that in the json file I find old filters/visuals of old version of the analysis? because I found filters where the dataset is noe even present anymore in my account…

Hi @remba87 - This symptom may happened due to different reasons. I will suggest to build a simple analysis to ensure your create API analysis worked fine from back end and you are able to see neat and clean report from UI side. Once the POC done, you can start customize and add features with create API.

Regards - Sanjeeb

1 Like

Regarding the weird format I understood what is happening.

I have spaces in the titles and also in the insights…those spaces are repalced by �

Also, I removed 2 reports from the analysis (the one that were giving problems) and everything worked as it should…

woulkd be nice to avoid in saving the cronology when exporting to json…

thank you for your help and advices!

1 Like

Thank you @remba87 . Glad the issue is resolved. Can you please mark the require suggestion as solution so that it can help wider QuickSight community.

Have a great week ahead.

Regards - Sanjeeb

FYI … depending on what you are trying to accomplish with the Create-Analysis API, you might be interested in OverSight for Amazon QuickSight

2 Likes