Api call Template creation only see the template arn in source entity same goes for dasaboarddefinition will not contain the SourceEntityArn key at all in its description.
Please help if via api/cli call we can get direct link to analysis as we get from console. i understand from template arn i can fetch the analysis but that will not help since the dashboard will still not be linked to its original analysis the dashboard will still not be linked to its original analysis.
when creating dashboard via API, it requires template as SourceEntity or JSON definition it definition. as you described, it is a bit different from the dashboard created via GUI. the template is created based on analysis so you should be able to link to the analysis if you see the result from describe-template API for the template that your dashboard is sourced.
as i mentioned i could find analysis by tracing back from template but i would require a direct connection. anyways if there is no way we can resolve this.
If a dashboard is deployed using the template. To get the analysis details which was used in template creation, you would need to run describe-template.
The describe-template-definition will give you the metadata for the analysis itself. Not the analysis arn.