Create teams in Atlassian Cloud using Postman and REST APIs

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

When to use this article

This article may be used any time there is a need to create teams in bulk in Atlassian Cloud.



Prepare data

  1. Use a text editor to prepare a text document listing the names of all teams to be created, as well as a second column providing a description if desired.
  2. Ensure the first row has a header row labelled teamName,teamDescription  .
    (warning) While a description for the team is not required, it is mandatory for the REST API call.
  3. Save the file as a csv, now containing a list of teams to be created.

Sample file

teamName,teamDescription
Transformers,Business transformation team
Project Matrix,
Platform CORE,
Team Cardguard,InfoSec
Pipedream,API team

Set up Postman

This section may be skipped if:

  • a collection named "Atlassian Cloud User Management" has previously been set up, and

  • an environment named "Atlassian Cloud" has previously been set up

Click here for instructions to set up Postman

Download Postman

  1. Download Postman from https://www.postman.com/downloads/

  2. Run Postman.

Create a new environment

  1. Click New, or type Ctrl + N (Windows/Linux) or Cmd + N (MacOS).

  2. Select “Environment”.

  3. Name the environment “Atlassian Cloud”.

  4. Set up the following variables:

    VariableTypeInitial value and Current valueComments

    cloudUrl

    default

    https://<yoursite>.atlassian.net

    Replace yoursite with your subdomain, e.g. acmecorp

    apiTokenEmailAddress

    default

    <youruser@yourdomain.com>

    Your Atlassian administrator account email

    apiToken

    secret

    From https://id.atlassian.com/manage-profile/security/api-tokens

    Manage API tokens for your Atlassian account

    Note that Postman variables are case-sensitive.

  5. Click Save towards the top right corner.

Create a new collection

  1. Click New, or type Ctrl + N (Windows/Linux) or Cmd + N (MacOS).

  2. Select “Collection”.

  3. Name the collection “Atlassian Cloud User Management”.

  4. Click the “Authorization” tab.
  5. Change Type to “Basic Auth”.

  6. Specify {{apiTokenEmailAddress}} as the Username. The text should be coloured orange, indicating that Postman has recognized a variable has been specified. This can be confirmed by hovering over the variable name.

  7. Specify {{apiToken}} as the Password. The text should be coloured orange, indicating that Postman has recognized a variable has been specified. This can be confirmed by hovering over the variable name.

  8. Click the “Tests” tab.

  9. Enter:

    pm.test("Request successful", function () {
        pm.expect(pm.response.code).to.be.oneOf([200,201,202,204]);
    });


    This allows us to ensure all REST APIs have been made successfully.

  10. Click Save towards the top right corner.

Find organization id

  1. Navigate to admin.atlassian.com.
  2. Select your organization if you have more than one.
  3. Observe your organization id from the URL:
    https://admin.atlassian.com/o/<orgId>/overview
    where the org id is a GUID, for example:
    7d737580-498a-1b1c-kcd1-kdjj1d0bada9

Find site id

  1. Navigate to admin.atlassian.com.
  2. Select your organization if you have more than one.
  3. Select Products from the top navigation bar.
  4. In the left navigation pane, select a site.
  5. Observe your site id from the URL:
    https://admin.atlassian.com/s//access-requests
    where the site id is a GUID, for example:
    6dbf9191-c42b-4988-97d7-45cb4f1112f7

Set up REST API call

  1. Click New, or type Ctrl + N  (Windows/Linux) or Cmd  + N (MacOS).

  2. Select "HTTP".

  3. Name the request "Create Team in Atlassian Cloud".

  4. Change the method from GET  to POST .

  5. In the URL, paste:

    {{cloudUrl}}/gateway/api/public/teams/v1/org/<orgId>/teams/
  6. Replace <orgId>  in the URL with the organization id previously obtained.
  7. Click the "Authorization" tab.

  8. Ensure Type is "Inherit auth from parent".

  9. Click the "Body" tab.
  10. Click "raw".

  11. Change the content type to "JSON".

  12. Paste the following block in payload area:

    {
      "displayName": "{{teamName}}",
      "description": "{{teamDescription}}",
      "siteId": "<siteId>",
      "teamType": "OPEN"
    }

    noting the {{teamName}} and {{teamDescription}} match the csv header (case-sensitive).
    Accepted values for teamType are:

    teamTypeDefinition
    OPENAny member of your organization may join the team without approval.
    MEMBER_INVITETeam members must be invited by a team administrator.
  13. Replace <siteId>  in the URL with the site id previously obtained.
  14. Click Save, saving into the "Atlassian Cloud User Management" collection.

Execute runner 

  1. Change the environment using the environment selector at the top right of Postman, selecting "Atlassian Cloud".

  2. Select Collections in the sidebar.

  3. Select the "Atlassian Cloud User Management" collection.

  4. On the Overview tab, select ▶️ Run towards the top right corner.

  5. Under Run order, ensure there is one and only REST API call - "Create Team in Atlassian Cloud".

  6. On the Functional tab, select Run manually.

  7. Click Data.

  8. Navigate to and select the previously prepared csv file.

  9. Reduce the number of "Iterations" under Run configuration to 1.

  10. Leave Advanced settings as is.

  11. Click Run Atlassian Cloud User Management.

  12. Check Postman to ensure the runner collection has passed all tests. The run results should show:

    1. "Iterations" and "All tests" to be equivalent in count

    2. Passed (n) where n is the number of iterations

    3. Failed (0)

    4. Skipped (0)

  13. Check Teams at your site, for example, https://bancly.atlassian.net/jira/people/search to ensure the team has been added.
    Alternatively, open your Jira site, then click on Teams  in the top navigation bar.

  14. Rerun Postman Runner following the previous steps, with the number of "Iterations" set to the number of rows in the csv file.

References


Last modified on Apr 24, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.