Error to import project using api/1.0/migration/imports
Asked by Antoine Ameline:

Hi

I have a bitbucket data-center server deployed on a Debian server.

I've been asked to deploy bitbucket data-center on our cluster. I did it using the helm chart provided by Atlassian.

Now I want to migrate my projects and repositories from my old instance to the new one (same data-center version 8.16.2 with a postgres base behind it).

To do this, I'd like to use the API described in the [documentation](https://confluence.atlassian.com/bitbucketserver0816/export-and-import-projects-and-repositories-1333334794.html))

No problem with export api it works well.

```
curl --location 'https://git.xxx.xxx.xx/bitbucket/rest/api/1.0/migration/exports' --header 'Content-Type: application/json' --header 'Authorization: Basic XXXXXXXXXXXXXXXXX' --data '{"repositoriesRequest":{"includes":[{"projectKey":"MDCONF","slug":"*"}]}}'
```

The file is generated. I copied it to my volume using "kubectl cp". The file size is 100 MB

My problem is to import the file in bitbucket.

Looking at documentation, I use the rest api/1.0/migration/imports but with failure 400 Bad Request  
++First try with relative path to the file++

```
curl --location 'https://git.xxx.xxx.xx/bitbucket/rest/api/1.0/migration/imports' --header 'Content-Type: application/json' --header 'Authorization: Basic XXXXXXXXXXXXXXXXX' --data '{"archivePath":"Bitbucket_export_2.tar"}'
```

> {  
> "errors": \[  
> {  
> "context": null,  
> "message": "Invalid import request, the archive 'Bitbucket_export_2.tar' could not be found",  
> "exceptionName": "com.atlassian.bitbucket.validation.ArgumentValidationException"  
> }  
> \]  
}  
++Second try with full path++

```
curl --location 'https://git.xxx.xxx.xx/bitbucket/rest/api/1.0/migration/imports' --header 'Content-Type: application/json' --header 'Authorization: Basic XXXXXXXXXXXXXXXXX' --data '{"archivePath":"/var/atlassian/application-data/bitbucket/shared/data/migration/import/Bitbucket_export_2.tar"}'
```

> {  
> "errors": \[  
> {  
> "context": null,  
> "message": "Import archive location is invalid.",  
> "exceptionName": "com.atlassian.bitbucket.validation.ArgumentValidationException"  
> }  
> \]  
}  
For the problem with the relative path, I checked my environment variables and $BITBUCKET_HOME is well set :

```
BITBUCKET_HOME=/var/atlassian/application-data/bitbucket
```

Looking at files, all seems to be ok :  
![bitbucket_volume.png](/t5/image/serverpage/image-id/317161i7506BAA2BD70627F/image-size/large?v=v2&px=999 "bitbucket_volume.png")  
How do I specify the archivePath to make the API work?  
Thanks for your help  
Antoine


Answers:
author: Neeraj Upadhyay
body: When you export a project/repo, the export tar file is created in \<Bitbucket-home\>/shared/data/migration/export folder, this tar file needs to be copied to \<Bitbucket-home\>/shared/data/migration/import folder and after that you would have to run the Import API call  

Kb: <https://confluence.atlassian.com/bitbucketserver/importing-957497836.html>

comments: author: Andreas Pabst
body: Hi Neeraj, can you please give us a hint what might be the reason if the export works, but the import from the location you mentioned results in a "You are not permitted to access this resource" response? The credentials used are the same. We're using the Docker container 8.19.1 with an internal database.


Tags: api

bitbucket-data-center

data-center

import

k8s