user Endpoint

このページの内容

概要

Use the /user endpoints to gets information related to the currently authenticated Bitbucket Cloud user. It is useful for OAuth or other in situations where the username is unknown. This endpoint returns information about an individual or team account. Individual and team accounts both have the same set of user fields:

フィールド 説明
ユーザ名 The name associated with the account.
first_name The first name associated with account.
last_name The last name associated with the account. For a team account, this value is always empty.
アバター An avatar associated with the account.
resource_uri The account resource identifier.
 

Both team and user accounts can have 0 or more repositories. For information on the contents of the repository resource, see the repositories Endpoint - 1.0.

GET a user profile

Gets the basic information associated with an account and a list of all of the repositories owned by the user.

GET https://api.bitbucket.org/1.0/user
Click to expand the response...
The response structure is the same for both individual and team accounts.

 

{
    "repositories": [
        {
            "scm": "git",
            "has_wiki": false,
            "last_updated": "2012-06-27 00:22:15",
            "creator": null,
            "created_on": "2012-06-27 00:22:15",
            "owner": "1team",
            "logo": null,
            "email_mailinglist": "",
            "is_mq": false,
            "size": 580,
            "read_only": false,
            "fork_of": null,
            "mq_of": null,
            "followers_count": 1,
            "state": "available",
            "utc_created_on": "2012-06-26 22:22:15+00:00",
            "website": "",
            "description": "",
            "has_issues": false,
            "is_fork": false,
            "slug": "justdirectteam",
            "is_private": true,
            "name": "justdirectteam",
            "language": "",
            "utc_last_updated": "2012-06-26 22:22:15+00:00",
            "email_writers": true,
            "no_public_forks": false,
            "resource_uri": "/1.0/repositories/1team/justdirectteam"
        }
    ],
    "user": {
        "username": "1team",
        "first_name": "1 Team",
        "last_name": "",
        "is_team": true,
        "avatar": "https://secure.gravatar.com/avatar/24b6be68b53e383c5d42bab4fe
0bde2b?d=https%3A%2F%2Fdwz7u9t8u8usb.cloudfront.net%2Fm%2Fcc0a0a43301e%2Fimg%2Ft
eam_no_avatar_32.png&s=32",
        "resource_uri": "/1.0/users/1team"
    }
}

Update a user

Updates the basic information associated with an account. It operates on the currently authenticated user. Specify one or more fields with the exception of the username field. This call ignores changes to the username field. Omitted fields retain their existing values. The call returns the user structure.

PUT https://api.bitbucket.org/1.0/user --data "field=value&field=value&..." 

Click to expand the response...

The response structure is the same for both individual and team accounts.

 {
        "username": "auserbb",
        "first_name": "foo",
        "last_name": "User",
        "is_team": false,
        "avatar": "https://secure.gravatar.com/avatar/49bd0ee69e520e8bc250adb95710bbb8?d=identicon&s=32",
        "resource_uri": "/1.0/users/auserbb"
}

GET a list of user privileges

Gets the account-level privileges for an individual or team account. Use this call to locate the accounts that the currently authenticated  accountname has access to. An account can have admin or collaborator (member) privileges. The accountname always has admin privileges on itself. 

GET   https://api.bitbucket.org/1.0/user/privileges
Individual account response. Click to expand...
{
    "teams": {
        "auserbb": "admin"
	"1team": "collaborator"
	"2team": "admin"
    }
}
Team account response. Click to expand...
{
    "teams": {
        "1team": "admin"
    }
} 

GET a list of repositories an account follows

Gets the details of the repositories that the individual or team account follows. This call returns the full data about the repositories including if the repository is a fork of another repository. An account always "follows" its own repositories. 

GET https://api.bitbucket.org/1.0/user/follows
Click to expand the response...

In the example below, auser-justdirectteam is a fork of the team justdirectteam repository.

 [
    {
        "scm": "git",
        "has_wiki": false,
        "last_updated": "2012-06-27 00:22:15",
        "creator": null,
        "created_on": "2012-06-27 00:22:15",
        "owner": "1team",
        "logo": null,
        "email_mailinglist": "",
        "is_mq": false,
        "size": 580,
        "read_only": false,
        "fork_of": null,
        "mq_of": null,
        "followers_count": 2,
        "state": "available",
        "utc_created_on": "2012-06-26 22:22:15+00:00",
        "website": "",
        "description": "",
        "has_issues": false,
        "is_fork": false,
        "slug": "justdirectteam",
        "is_private": true,
        "name": "justdirectteam",
        "language": "",
        "utc_last_updated": "2012-06-26 22:22:15+00:00",
        "email_writers": true,
        "no_public_forks": false,
        "resource_uri": "/1.0/repositories/1team/justdirectteam"
    },
    {
        "scm": "hg",
        "has_wiki": false,
        "last_updated": "2012-07-12 01:50:25",
        "creator": null,
        "created_on": "2012-07-12 01:50:25",
        "owner": "auserbb",
        "logo": null,
        "email_mailinglist": "",
        "is_mq": false,
        "size": 541,
        "read_only": false,
        "fork_of": null,
        "mq_of": null,
        "followers_count": 1,
        "state": "available",
        "utc_created_on": "2012-07-11 23:50:25+00:00",
        "website": "",
        "description": "",
        "has_issues": false,
        "is_fork": false,
        "slug": "myowncode",
        "is_private": true,
        "name": "myowncode",
        "language": "",
        "utc_last_updated": "2012-07-11 23:50:25+00:00",
        "email_writers": true,
        "no_public_forks": false,
        "resource_uri": "/1.0/repositories/auserbb/myowncode"
    },
    {
        "scm": "git",
        "has_wiki": false,
        "last_updated": "2012-07-12 01:53:01",
        "creator": null,
        "created_on": "2012-07-12 01:53:01",
        "owner": "auserbb",
        "logo": null,
        "email_mailinglist": "",
        "is_mq": false,
        "size": 659,
        "read_only": false,
        "fork_of": {
            "scm": "git",
            "has_wiki": false,
            "last_updated": "2012-06-27 00:22:15",
            "creator": null,
            "created_on": "2012-06-27 00:22:15",
            "owner": "1team",
            "logo": null,
            "email_mailinglist": "",
            "is_mq": false,
            "size": 580,
            "read_only": false,
            "fork_of": null,
            "mq_of": null,
            "followers_count": 2,
            "state": "available",
            "utc_created_on": "2012-06-26 22:22:15+00:00",
            "website": "",
            "description": "",
            "has_issues": false,
            "is_fork": false,
            "slug": "justdirectteam",
            "is_private": true,
            "name": "justdirectteam",
            "language": "",
            "utc_last_updated": "2012-06-26 22:22:15+00:00",
            "email_writers": true,
            "no_public_forks": false,
            "resource_uri": "/1.0/repositories/1team/justdirectteam"
        },
        "mq_of": null,
        "followers_count": 1,
        "state": "available",
        "utc_created_on": "2012-07-11 23:53:01+00:00",
        "website": null,
        "description": "",
        "has_issues": false,
        "is_fork": true,
        "slug": "auser-justdirectteam",
        "is_private": true,
        "name": "auser-justdirectteam",
        "language": "",
        "utc_last_updated": "2012-07-11 23:53:01+00:00",
        "email_writers": true,
        "no_public_forks": false,
        "resource_uri": "/1.0/repositories/auserbb/auser-justdirectteam"
    }
]

GET a list of repositories visible to an account

Gets the details of the repositories that the user owns or has at least read access to. Use this if you're looking for a full list of all of the repositories associated with a user.

GET https://api.bitbucket.org/1.0/user/repositories
Click to expand the response...

In the example below, auser-justdirectteam is a fork of the team's justdirectteam repository.

 [
    {
        "scm": "git",
        "has_wiki": false,
        "last_updated": "2012-06-27 00:22:15",
        "creator": null,
        "created_on": "2012-06-27 00:22:15",
        "owner": "1team",
        "logo": null,
        "email_mailinglist": "",
        "is_mq": false,
        "size": 580,
        "read_only": false,
        "fork_of": null,
        "mq_of": null,
        "followers_count": 2,
        "state": "available",
        "utc_created_on": "2012-06-26 22:22:15+00:00",
        "website": "",
        "description": "",
        "has_issues": false,
        "is_fork": false,
        "slug": "justdirectteam",
        "is_private": true,
        "name": "justdirectteam",
        "language": "",
        "utc_last_updated": "2012-06-26 22:22:15+00:00",
        "email_writers": true,
        "no_public_forks": false,
        "resource_uri": "/1.0/repositories/1team/justdirectteam"
    },
    {
        "scm": "hg",
        "has_wiki": false,
        "last_updated": "2012-07-12 01:50:25",
        "creator": null,
        "created_on": "2012-07-12 01:50:25",
        "owner": "auserbb",
        "logo": null,
        "email_mailinglist": "",
        "is_mq": false,
        "size": 541,
        "read_only": false,
        "fork_of": null,
        "mq_of": null,
        "followers_count": 1,
        "state": "available",
        "utc_created_on": "2012-07-11 23:50:25+00:00",
        "website": "",
        "description": "",
        "has_issues": false,
        "is_fork": false,
        "slug": "myowncode",
        "is_private": true,
        "name": "myowncode",
        "language": "",
        "utc_last_updated": "2012-07-11 23:50:25+00:00",
        "email_writers": true,
        "no_public_forks": false,
        "resource_uri": "/1.0/repositories/auserbb/myowncode"
    },
    {
        "scm": "git",
        "has_wiki": false,
        "last_updated": "2012-07-12 01:53:01",
        "creator": null,
        "created_on": "2012-07-12 01:53:01",
        "owner": "auserbb",
        "logo": null,
        "email_mailinglist": "",
        "is_mq": false,
        "size": 659,
        "read_only": false,
        "fork_of": {
            "scm": "git",
            "has_wiki": false,
            "last_updated": "2012-06-27 00:22:15",
            "creator": null,
            "created_on": "2012-06-27 00:22:15",
            "owner": "1team",
            "logo": null,
            "email_mailinglist": "",
            "is_mq": false,
            "size": 580,
            "read_only": false,
            "fork_of": null,
            "mq_of": null,
            "followers_count": 2,
            "state": "available",
            "utc_created_on": "2012-06-26 22:22:15+00:00",
            "website": "",
            "description": "",
            "has_issues": false,
            "is_fork": false,
            "slug": "justdirectteam",
            "is_private": true,
            "name": "justdirectteam",
            "language": "",
            "utc_last_updated": "2012-06-26 22:22:15+00:00",
            "email_writers": true,
            "no_public_forks": false,
            "resource_uri": "/1.0/repositories/1team/justdirectteam"
        },
        "mq_of": null,
        "followers_count": 1,
        "state": "available",
        "utc_created_on": "2012-07-11 23:53:01+00:00",
        "website": null,
        "description": "",
        "has_issues": false,
        "is_fork": true,
        "slug": "auser-justdirectteam",
        "is_private": true,
        "name": "auser-justdirectteam",
        "language": "",
        "utc_last_updated": "2012-07-11 23:53:01+00:00",
        "email_writers": true,
        "no_public_forks": false,
        "resource_uri": "/1.0/repositories/auserbb/auser-justdirectteam"
    }
]

GET a list of repositories the account is following

Gets a list of the repositories the account follows.  This is the same list that appears on the Following tab on your account dashboard.

GET https://api.bitbucket.org/1.0/user/repositories/overview
Click to expand the response...
{
    "updated": [
        {
            "owner": "auserbb",
            "name": "auser-justdirectteam",
            "slug": "auser-justdirectteam",
            "is_private": true,
            "avatar": "https://secure.gravatar.com/avatar/49bd0ee69e520e8bc250adb95710bbb8?d=identicon&s=16"
        },
        {
            "owner": "auserbb",
            "name": "myowncode",
            "slug": "myowncode",
            "is_private": true,
            "avatar": "https://secure.gravatar.com/avatar/49bd0ee69e520e8bc250adb95710bbb8?d=identicon&s=16"
        },
        {
            "owner": "1team",
            "name": "justdirectteam",
            "slug": "justdirectteam",
            "is_private": true,
            "avatar": "https://secure.gravatar.com/avatar/24b6be68b53e383c5d42bab4fe0bde2b?d=https%3A%2F%2Fdwz7u9t8u8usb.clou
dfront.net%2Fm%2Fe7650dc4b9dd%2Fimg%2Fteam_no_avatar.png&s=16"
        }
    ],
    "viewed": []
}

GET the list of repositories on the dashboard

Gets the repositories list from the account's dashboard.

GET https://api.bitbucket.org/1.0/user/repositories/dashboard
Click to expand the response...
[
    [
        {
            "username": "buserbb",
            "first_name": "B",
            "last_name": "userbb",
            "is_team": false,
            "avatar": "https://secure.gravatar.com/avatar/b677e1e3bf1c781f852b288fd4b68480?d=https%3A%2F%2Fdwz7u9t8u8usb.cloudfront.net%2Fm%2F33b98326237f%2Fimg%2Fdefault_avatar%2F32%2Fuser_blue.png&s=32",
            "resource_uri": "/1.0/users/buserbb"
        },
        [
            {
                "website": "",
                "fork": false,
                "name": "mybuserrepo",
                "scm": "git",
                "absolute_url": "/buserbb/mybuserrepo/",
                "_pk": 1046047,
                "owner": "buserbb",
                "slug": "mybuserrepo",
                "is_private": true
            },
            {
                "website": null,
                "fork": "/tutorials/tutorials.bitbucket.org",
                "name": "myquotefork",
                "scm": "hg",
                "absolute_url": "/buserbb/myquotefork/",
                "_pk": 1446971,
                "owner": "buserbb",
                "slug": "myquotefork",
                "is_private": false
            }
        ]
    ],
    [
        {
            "username": "2team",
            "first_name": "2 Team",
            "last_name": "",
            "is_team": true,
            "avatar": "https://secure.gravatar.com/avatar/15827007bdb707832ded90a612750cfb?d=https%3A%2F%2Fdwz7u9t8u8usb.cloudfront.net%2Fm%2F33b98326237f%2Fimg%2Fdefault_team_avatar%2F32%2Fteam_blue.png&s=32",
            "resource_uri": "/1.0/users/2team"
        },
        [
            {
                "website": "",
                "fork": false,
                "name": "teamproject",
                "scm": "git",
                "absolute_url": "/2team/teamproject/",
                "_pk": 1088776,
                "owner": "2team",
                "slug": "teamproject",
                "is_private": true
            },
            {
                "website": "",
                "fork": false,
                "name": "public2teamrepo",
                "scm": "hg",
                "absolute_url": "/2team/public2teamrepo/",
                "_pk": 1181363,
                "owner": "2team",
                "slug": "public2teamrepo",
                "is_private": false
            }
        ]
    ]
] 
Last modified on Apr 18, 2016

この翻訳に満足しましたか?

はい
いいえ
この記事についてのフィードバックを送信する

お探しの情報が見つかりませんか?

コミュニティへの質問

Powered by Confluence and Scroll Viewport.