How to create and update Rally ProjectPermission, WorkspacePermission, Subscription Administrators and add TeamMemberships with Web Services API
search cancel

How to create and update Rally ProjectPermission, WorkspacePermission, Subscription Administrators and add TeamMemberships with Web Services API

book

Article ID: 47760

calendar_today

Updated On:

Products

Rally On-Premise Rally SaaS

Issue/Introduction

Below are examples of requests made via REST to create and update ProjectPermission, WorkspacePermission, Subscription Administrators and add TeamMemberships with WS API.  

 

Resolution

 

I. USING API KEY AUTHENTICATION

Note: generally this is a preferred method of authentication. It is easier to use, it does not require additional authentication with a security token, and unlike the security token, ApiKey is not session-specific (which makes it unnecessary to manually maintain a session when POST requests are made outside of a browser, e.g. with a curl command).

  • 1. Generate ApiKey if it has not been already generated
  • 2. Create projectpermission

 

II. USING BASIC AUTHENTICATION AND SECURITY TOKEN

Note: this authentication method should be used in subscriptions where ApiKey is disabled, and on Sandbox where ApiKey is not supported.

At the time of creation this user /user/<USER_OID> was given viewer permissions to one project:

  • Create project permission
    • Get a security token: https://rally1.rallydev.com/slm/webservice/v2.0/security/authorize
    • Method: GET
    • A token is returned: {"OperationResult": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "Errors": [], "Warnings": [], "SecurityToken": "cb9473f7-....."}}
  • Create projectpermission. Notice the security token appended to the request: https://rally1.rallydev.com/slm/webservice/v2.0/projectpermission/create?key=cb9473f7-....
  • Method: POST
  • Payload:
    • {"ProjectPermission":{
      "Project":{"_ref":"/project/<PROJECT_OID>"},
      "Role":"Viewer",
      "User":{"_ref":"/user/<USER_OID>"}
      }}
  • ContentType: application/json
  • Here is a screenshot from a REST client:

and a screenshot of the result:

 

Verified in UI:

Create team membership:

When both examples are demonstrated during the same session, the same security token can be used. No need to repeat step 1 from Example 1.

2. add team memberships.

Notice the security token appended to the request:

https://rally1.rallydev.com/slm/webservice/v2.0/user/<USER_OID>/teammemberships/add?key=cb9473f7-.....

Method: POST

Payload:

{ "CollectionItems":[{"_ref":"/project/<PROJECT_OID>"},{"_ref":"/project/<PROJECT_OID>"}] }

 

Verified success in UI:

 

To CREATE a Workspace Administrator use the following:

  • Endpoint URL:  https://rally1.rallydev.com/slm/webservice/v2.0/workspacepermission/create
  • Method: POST
  • Payload:
    • {"WorkspacePermission":{
      "workspace":{"_ref":"/workspace/<WORKSPACE_OID>"},
      "Role":"Admin",
      "User":{"_ref":"/user/<USER_OID>"}
      }}
  • ContentType: application/json
 

 

To UPDATE a user to a Workspace Administrator use the following:

  • Endpoint URL: https://rally1.rallydev.com/slm/webservice/v2.0/user/<UserObjectID>/permissionmap
  • Method: POST
  • Payload:
    • {"NoAccessWorkspaces":[],
    • "EditorProjects":[],
       "UserWorkspaces":[],
       "AdminProjects":[],
       "ViewerProjects":[],
       "AdminWorkspaces":[<WorkspaceObjectID>,<WorkspaceObjectID>etc...],
       "MembershipProjects":[],
       "NoMembershipProjects":[],
       "NoAccessProjects":[]}
 
 

To create a Subscription Administrator use the following:

  • Endpoint URL: https://rally1.rallydev.com/slm/webservice/v2.0/user/<USER_OBJECTID>/setpermissionflags
  • Method: POST
  • Payload
    • {"SetPermissionFlags":{
      "SubscriptionAdmin":true
      }
      }

Additional Information

keywords: agile central rally WSAPI web services