Hello
How I can create Project using API?
I had try this one
https://developer.atlassian.com/bitbucket/api/2/reference/resource/teams/%7Busername%7D/projects/
But getting this a out put after running the bash script.
< HTTP/2 401
< server: nginx
* Authentication problem. Ignoring this.
< www-authenticate: Basic realm="Bitbucket.org HTTP"
< content-type: text/html; charset=utf-8
< strict-transport-security: max-age=31536000; includeSubDomains; preload
< date: Mon, 19 Aug 2019 16:22:42 GMT
< x-served-by: app-159
< x-static-version: 2f8d6eb2653c
< etag: "d41d8cd98f00b204e9800998ecf8427e"
< x-render-time: 0.199751138687
< x-version: 2f8d6eb2653c
< x-request-count: 139
< x-frame-options: SAMEORIGIN
< content-length: 0
Would you please some body help me.
Hi Umar, welcome to the Community!
Thank you for your question and for showing us the output you're receiving. To help you with this, we'll need to know what request are you sending to Bitbucket, can you show us the exact command you're using?
Also, note that projects are only available for teams, so you should be creating it in a Team account and not an individual account. Your user also needs to have the necessary permissions to create projects in the team.
Cheers,
Ana
Hi Ana,
Thanks for your reply here is my complete code
body=$(cat << EOF
{
"name": "UDZ",
"key": "UDZ",
"description": "Umar Draz Api Testing",
"links": {
"avatar": {
"href": "http://icons.iconarchive.com/icons/guillendesign/variations-3/256/Default-Icon-icon.png"
}
},
"is_private": true
}
EOF
)
curl -v -u myusername:mypassword -H "Content-Type: application/json" \
-X POST \
-d "$body" \
https://api.bitbucket.org/2.0/teams/<team_name>/projects/
The username, password and team name is dummy, because I can not share here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Umar,
I've tried reproducing this issue using the code you provided and it worked for me. You can see my output here:
curl -D- -u USERNAME:APP-PASSWORD -H "Content-Type: application/json" -X POST -d '{"name":"UDZ","key":"UDZ","description":"Umar Draz Api Testing","links":{"avatar":{"href":"http://icons.iconarchive.com/icons/guillendesign/variations-3/256/Default-Icon-icon.png"}},"is_private":true}' https://api.bitbucket.org/2.0/teams/TEAM-NAME/projects/
HTTP/2 201
server: nginx
vary: Authorization
[…]
{
"description": "Umar Draz Api Testing",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/teams/TEAM-NAME/projects/UDZ"
[....]
}
This confirms that the code you're using is correct, and the issue must rely on the authentication, as outlined in the error message in the response header you provided:
< HTTP/2 401
Once you re-try the steps, make sure the authentication is correct by completing the following:
Let us know how it goes!
Cheers,
Ana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So glad to hear that, Umar.
Have a great weekend :)
Ana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.