cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Rest API Error 404

hbs59
New Contributor III

I am trying to export a notebook or directory using /api/2.0/workspace/export.

When I run /api/2.0/workspace/list with a particular url and path, I get the results that I expect, a list of objects (notebooks and folders) at that location.

But when I run /api/2.0/workspace/export with the same url and path, I get an error 404: resource does not exist.

Why would this be?

 

requests.request(
    method = 'GET',
    url = 'https://{host}/api/2.0/workspace/list',
    params = {'path' : '/Users/{user}/{folder}/'},
    headers = {'Authorization' : f'Bearer {host_token}'}
    )

requests.request(
    method = 'GET',
    url = 'https://{host}/api/2.0/workspace/export/', 
    params = {'path' : '/Users/{user}/{folder}/', 'format' : 'AUTO', 'direct_download' : True},
    headers = {'Authorization' : f'Bearer {host_token}'}
    )

 

1 ACCEPTED SOLUTION

Accepted Solutions

nkraj
Databricks Employee
Databricks Employee

Hi @hbs59 , Could you please try changing the export URL from : 

 

https://{host}/api/2.0/workspace/export/

 

To : 

 

https://{host}/api/2.0/workspace/export

 

Removing Extra '/' from the end.

View solution in original post

5 REPLIES 5

Debayan
Databricks Employee
Databricks Employee

Hi, Could you please remove the parameters , (format and direct_download) and confirm? 

hbs59
New Contributor III

Sure, I ran the following:

requests.request(
    method = 'GET',
    url = 'https://{host}/api/2.0/workspace/export/', 
    params = {'path' : '/Users/{user}/{folder}/'},
    headers = {'Authorization' : f'Bearer {host_token}'}
    )

As far as I can tell, the error is the same:

<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 404 Bad Target: GET /2.0/workspace/export/</title>
</head>
<body><h2>HTTP ERROR 404 Bad Target: GET /2.0/workspace/export/</h2>
<table>
<tr><th>URI:</th><td>/api/2.0/workspace/export/</td></tr>
<tr><th>STATUS:</th><td>404</td></tr>
<tr><th>MESSAGE:</th><td>Bad Target: GET /2.0/workspace/export/</td></tr>
<tr><th>SERVLET:</th><td>com.databricks.webapp.WebappDispatcherServletWithProxy-45f675a4</td></tr>
</table>

 

Debayan
Databricks Employee
Databricks Employee

Hi, Could you please raise a support ticket with us to investigate this further? We want to run this and check in your workspace. 

hbs59
New Contributor III

Hi, thank you for following up. I just opened a ticket for this.

nkraj
Databricks Employee
Databricks Employee

Hi @hbs59 , Could you please try changing the export URL from : 

 

https://{host}/api/2.0/workspace/export/

 

To : 

 

https://{host}/api/2.0/workspace/export

 

Removing Extra '/' from the end.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group