Dashboard panels not loading properly

Hi All,

I am creating Dashboards through dashboard http api call. Everything is getting created, but panels are not loading properly. Every time I have to reselect datasource name and then then panel will load properly.
Datasource is already created with exact name and only that datasource is present.