Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Export fails with 'You are not permitted to access this resource'

Denys Zhuravel
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 13, 2023
We have Bitbucket version `7.21.2`

This is the export documentation for this version:

The documentation says this:
> There’s no graphical user interface in the initial (Bitbucket Server 5.14) release of this feature. Instead, REST calls can be made to control the migration process.

This is what it says to do to trigger the export for a project:
> curl -u <adminusername> -s -n -X POST -H ‘Content-type: application/json’ -d ‘{“repositoriesRequest”:{“includes”:[{“projectKey”:“”,“slug”:“”}]}}’ http://localhost:7990/rest/api/1.0/migration/exports | jq .

The documentation specifies that I have to use the admin user (which I am). I created a PAT using this documentation:

My permissions for the token are set as following:
* Project permissions: admin
* Repository permissions: admin

I am calling the API using the following command:

```
curl --request POST \
--user my.user:MY_TOKEN_FROM_SETTINGS \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"repositoriesRequest": {
"includes": [
{
"projectKey": "SOME_KEY",
"slug": "SOME_SLUG"
}
]
}
}'
```
And this is the error that I am getting back:

```
{"errors":[{"context":null,"message":"You are not permitted to access this resource","exceptionName":"com.atlassian.bitbucket.AuthorisationException"}]}%
```

I tried sending gibberish in the user field to verify that that is correct and the response is actually different:

```
{"errors":[{"context":null,"message":"Authentication failed. Please check your credentials and try again.","exceptionName":"com.atlassian.bitbucket.auth.IncorrectPasswordAuthenticationException"}]}%
```

What am I doing wrong here?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events