Unable to disable forking of any repository in Bitbucket using API

aman.v
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!
June 2, 2023

I'm trying to disable fork in existing repo with below details using bitbucket API's:

1.

curl -X PUT \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/hooks' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
--data '{
"fork_policy": "no_forks"
}'

2.

curl --request PUT --user username:password --header "Content-Type: application/json" --data '{"fork_policy": "no_forks"}' https://api.bitbucket.org/2.0/repositories/workspace/repo_name

In both the cases, it is giving the same error: This endpoint does not support token-based authenticationcurl: (6) Could not resolve host: Bitbucket

I've tried by replacing PUT by POST but still not getting the result

1 answer

0 votes
aman.v
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!
June 25, 2023

I got the solution for above query:

 

curl --request PUT \

  --url 'https://api.bitbucket.org/2.0/repositories/workspace/repo_name' \

  --header 'Authorization: Bearer <access_token>' \

  --header 'Accept: application/json' \

  --header 'Content-Type: application/json' \

  --data '{ "fork_policy": "no_forks" }'

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events