You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/07/08 14:40:36 UTC

[GitHub] [superset] rahul149386 opened a new issue, #20655: [Import] Unable to import Dashboard using Rest API

rahul149386 opened a new issue, #20655:
URL: https://github.com/apache/superset/issues/20655

   Hi, 
   
   I'm implementing importing dashboard using REST API. The response received 200 but when I checked in the Superset, it is not published. It is happing for the existed or new dashboard. Could you recommend me pls to resolve this isse.
   
    
   ![image](https://user-images.githubusercontent.com/56782848/178014510-c9b162de-e246-432f-b4c3-f0d95be24a21.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] musicmuthu commented on issue #20655: [Import] Unable to import Dashboard using Rest API

Posted by GitBox <gi...@apache.org>.
musicmuthu commented on issue #20655:
URL: https://github.com/apache/superset/issues/20655#issuecomment-1340960774

   Hi @rahul149386  
   Can you please share the right one


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rahul149386 commented on issue #20655: [Import] Unable to import Dashboard using Rest API

Posted by GitBox <gi...@apache.org>.
rahul149386 commented on issue #20655:
URL: https://github.com/apache/superset/issues/20655#issuecomment-1180347379

   Any Update on this ticket.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rahul149386 closed issue #20655: [Import] Unable to import Dashboard using Rest API

Posted by GitBox <gi...@apache.org>.
rahul149386 closed issue #20655: [Import] Unable to import Dashboard using Rest API
URL: https://github.com/apache/superset/issues/20655


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] musicmuthu commented on issue #20655: [Import] Unable to import Dashboard using Rest API

Posted by GitBox <gi...@apache.org>.
musicmuthu commented on issue #20655:
URL: https://github.com/apache/superset/issues/20655#issuecomment-1348188915

   @rahul149386  Hi rahul can you please throw some light for this issue


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rahul149386 commented on issue #20655: [Import] Unable to import Dashboard using Rest API

Posted by GitBox <gi...@apache.org>.
rahul149386 commented on issue #20655:
URL: https://github.com/apache/superset/issues/20655#issuecomment-1181719031

   I'm using couple of methods to import superset dashboard but I'm getting failed. Anyone kindly have a look into this.
   
   Method1: Using Request : 
   
   session  = requests.session()
   r = session.post(base_url + '/api/v1/security/login', json=payload)
   access_token = r.json()
   
   headersAuth = {
       'Authorization': 'Bearer ' + access_token['access_token']
   }
   csrf_token = requests.get(
       url=base_url+'/api/v1/security/csrf_token/',
       headers=headersAuth
   ).json()["result"]
   data = {
           'username': 'admin',
           'password': 'password',
           'csrf_token':csrf_token
   }
   session.post(f'{base_url}/login/', data=data)
   cookies=dict(session.cookies)
   cookies=cookies['session']
   dashboard_path='dashboard_path'
   
   import_url=base_url+'/api/v1/dashboard/import/'
   headers = {
       'accept': 'application/json',
       'Authorization':headersAuth['Authorization'],
       'X-CSRFToken': csrf_token,
       'Cookies':f'Session={cookies[1:]}',
       'Referer': import_url
   }
   
   files = {
       'formData': (
           dashboard_path,
          open(dashboard_path, 'r'),
           'application/json'
       )
   }
   response = requests.post(import_url, files=files, headers=headers)
   print(response)
   session.close()
   Eroor:
   Getting an Response 200 but unable to see the dashboard in the superset
   ![image](https://user-images.githubusercontent.com/56782848/178491686-5bbc2cce-a8cb-4df2-b9f3-a04e205d16eb.png)
   
   Method2: Running a Curl though python
   lst1=f'curl --location --request POST {import_url}\ -H "X-CSRFToken:{csrf_token}"\ -H "Authorization:{Authorization}"\ -H "Cookie:session={cookies}"\--form "formData=@"{dashboard_path}""\ --form "overwrite="true"'
   args = lst1.split(maxsplit=-1)
   print(args)
   process = subprocess.Popen(args,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
   stdout,stderr= process.communicate()
   Error:
   Could not resolve host:\ncurl: (3) URL using bad/illegal format or missing URL\n'
   
   Anyone responses will be apprciated.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org