Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to create a project using rest api

Aman Tur March 15, 2022

I'm trying to create a project using REST API. Every time I'm getting internal server error like this:

 

{
    "type""error",
    "error": {
        "message""Something went wrong",
        "id""0bd3a5f302e843fda412d6416a17beef"
    }
}
EDIT: URL https://api.bitbucket.org/2.0/workspaces/<workspace>/projects

2 answers

0 votes
Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 17, 2022

Hi, Aman, thank you for reaching out to Atlassian Community.

I tested this on my side and was able to create a project using the following API: 

Here is an example that you can follow, you just need to inform your workspace ID, the project name, and the key you would like to create:

curl --request POST -u username:AppPassword \
--url 'https://api.bitbucket.org/2.0/workspaces/{workspace_ID}/projects' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"key": "{inform_a_key}",
"name": "{project_name}",
"is_private": true
}'

Please let me know how it goes and feel free to share any additional questions or concerns regarding this case.

Kind regards,
Caroline 

Our annual user conference, Team ’22 is back! Join us in Las Vegas starting April 5th or attend digitally on April 6th. Register now: https://events.atlassian.com/team22

0 votes
Sunny Ape
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 15, 2022

Hello @Aman Tur 

You've probably submitted an invalid request.

Aman Tur March 16, 2022

The payload is from the example:

 

{
"name": "CloudX",
"key": "CEX",
"description": "This Project is for the CloudX.",
"is_private": true,
"has_publicly_visible_repos": false,
"type": "project",
"uuid": "c35b960d-3c0e-467b-81d4-b43368beac96",
"links": {
"avatar": {
"href": "https://.../default.png"
}
}
}
Sunny Ape
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 16, 2022

You haven't provided any information as to which Bitbucket REST API endpoint you're sending that request to or the method, so I'll have to guess.... you're sending a POST request to:

/2.0/workspaces/{workspace}/projects

You haven't advised if the request works if you omit all the un-required parameters and just define the required ones like name, keyis_private and description, so I'll have to guess... you haven't tested that.

Aman Tur March 16, 2022

Hi @Sunny Ape,

I've tried only required parameters and still getting the same. I've updated the URL in question as well.

Sunny Ape
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 16, 2022

I'm able to create projects in one of the workspaces of my Bitbucket Cloud account using that REST API endpoint with only those required parameters without any errors.

Nobody else seems to be reporting any problems with Bitbucket Cloud's REST API, so if it's affecting just you and just that REST API endpoint and no others, and you've tried all the obvious usual things like:

  • Testing with another OAuth key / token
  • Checking with another method (different dev tool / language)
  • Checking with a test tool like Postman

...and the error persists, I suggest you raise a support request with Atlassian.

Good luck.

Aman Tur March 16, 2022

I'm using Postman already, but using another access key does look promising.

Like Stefan Salzl likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events