Missed Team ’24? Catch up on announcements here.

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

How do you find the repo slug?

Deleted user July 15, 2016

This question is in reference to Atlassian Documentation: What is a Slug

I understand what a slug IS and I have some idea of how to construct a slug from a name in some cases (the articles gives two examples).

But I'm not interesting in CONSTRUCTING a slug. I want to know what the slug is for my repository. How do I find that?  

"What are you trying to do?" I hear you ask. I'm trying to construct a REST API call which requires that I put in the <owner> and the <repro_slug>. 

 

Thanks

 

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

7 votes
DrSnigglypoof
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 15, 2016

Hello Dave,

You can find the repo-slug in the URL for your repository.

For example in one of my test repositories, documentation-tests, the URL is:

https://bitbucket.org/teamsinspace/documentation-tests 

Teamsinspace is the owner, and documentation-tests is the repo slug.

So an API call for that would look something like this:

curl https://api.bitbucket.org/2.0/repositories/teamsinspace/documentation-tests


which would output something like this:

{
    "created_on": "2014-07-24T21:48:26.648365+00:00",
    "description": "",
    "fork_policy": "allow_forks",
    "full_name": "teamsinspace/documentation-tests",
    "has_issues": true,
    "has_wiki": true,
    "is_private": false,
    "language": "",
    "links": {
        "avatar": {
            "href": "https://bitbucket.org/teamsinspace/documentation-tests/avatar/32/"
        },
        "branches": {
            "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/documentation-tests/refs/branches"
        },
        "clone": [
            {
                "href": "https://bitbucket.org/teamsinspace/documentation-tests.git",
                "name": "https"
            },
            {
                "href": "ssh://git@bitbucket.org/teamsinspace/documentation-tests.git",
                "name": "ssh"
            }
        ],
        "commits": {
            "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/documentation-tests/commits"
        },
        "downloads": {
            "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/documentation-tests/downloads"
        },
        "forks": {
            "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/documentation-tests/forks"
        },
        "hooks": {
            "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/documentation-tests/hooks"
        },
        "html": {
            "href": "https://bitbucket.org/teamsinspace/documentation-tests"
        },
        "pullrequests": {
            "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/documentation-tests/pullrequests"
        },
        "self": {
            "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/documentation-tests"
        },
        "tags": {
            "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/documentation-tests/refs/tags"
        },
        "watchers": {
            "href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/documentation-tests/watchers"
        }
    },
    "name": "documentation-tests",
    "owner": {
        "display_name": "Teams In Space ",
        "links": {
            "avatar": {
                "href": "https://bitbucket.org/account/teamsinspace/avatar/32/"
            },
            "html": {
                "href": "https://bitbucket.org/teamsinspace/"
            },
            "self": {
                "href": "https://api.bitbucket.org/2.0/teams/teamsinspace"
            }
        },
        "type": "team",
        "username": "teamsinspace",
        "uuid": "{61fc5cf6-d054-47d2-b4a9-061ccf858379}"
    },
    "project": {
        "key": "MS",
        "links": {
            "avatar": {
                "href": "https://bitbucket.org/account/user/teamsinspace/projects/MS/avatar/32"
            },
            "html": {
                "href": "https://bitbucket.org/account/user/teamsinspace/projects/MS"
            }
        },
        "name": "Master station",
        "type": "project",
        "uuid": "{a89a4a24-f7f4-46a8-a50b-8d5a11b89781}"
    },
    "scm": "git",
    "size": 1122532,
    "type": "repository",
    "updated_on": "2016-03-15T17:30:25.209238+00:00",
    "uuid": "{b4434b4d-6a0e-4f57-8d75-e02a824abeb0}",
    "website": ""
}

Hope that's helpful.

Happy coding,

Dan

5 votes
Paul Morgan September 30, 2016

It would be really helpful if a call to a repository or All repositories contained this slug as a property. They already supply a 'name' and a 'full_name', but these both require some work to manipulate the values into a slugified value.

As BB already generate the slug (it goes into the URL) then why not supply it as a value on the objects returned?

3 votes
aMarcus
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 15, 2016

Hi Dave,

The repository slug is found in the URL for your repository. For example, in the following public Atlassian repository https://bitbucket.org/atlassian/atlassian-webhooks-plugin. The repository slug is `atlassian-webhooks-plugin`. This is the format for all repo URLs on bitbucket: https://bitbucket.org/<owner_username>/<repository_slug>

 

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events