Cannot create VSTS Security Group using API - azure-devops-rest-api

I am attempting to create new project-level security groups using the vsts api.
Creating a new group at the collection level works as documented.
However, creating a new group at the project level isn't working. When I call the API as documented, I end up with another a group at the collection level.
How should the create work at the project level? Is there someplace I should be looking for more examples and clarification?
Thanks!!

Please try below REST API to create a project level security group:
POST https://{accountName}.visualstudio.com/{ProjectName}/_api/_identity/ManageGroup
Content-Type : application/json
{"name":"GroupNamehere","description":"Create a Test Group 0505 ","tfid":""}

Related

How to list permissions in source control for Azure DevOps Server

I need to review all source code permissions on a particular folder structure. I have gone through the apis and can't find what I need or haven't figured out how to use them correctly yet.
I have also tried the tfssecurity command but, can't figure out how to make it look at just a specific team project.
I am using Azure DevOps Server 2020 and the source is in TFVC.
This is part of a source control audit and I need to produce a report of what permissions users have on a folder in source.
I have tried the following apis: https://learn.microsoft.com/en-us/rest/api/azure/devops/security/?view=azure-devops-server-rest-6.0
Along with the tfssecurity command.
None are producing the results I need.
Found the APIs needed to do this.
Use this one to get all of the namespaces and find the ones that you want to get the security data for.
https://{instance}/{collection}/_apis/securitynamespaces
After that call this API to get the ACLs for that namespace.
https://{instance}/{collection}/_apis/accesscontrollists/{securityNamespaceId}?alwaysAllowAdministrators=True
Once you get all of the ACLs for the namespace, you can then look at each ACE to find out the permissions.
https://{instance}/{collection}/_apis/identities?descriptors={descriptors}&queryMembership=expandedDown

Making plugin for JIRA

I am creating a JIRA plugin to fetch the issue-level permissions. Currently, the project-level permissions are working extremely fine but the issue-level permissions are not working. I tried finding a REST API to handle these permissions but, didn’t find anything so I decided to make a custom JIRA plugin to fetch the issue-level permissions of a project and handle them via exposing the plugin through an API.
My question is that what JIRA JAVA APIs do I have to use in order to handle these permissions? Or, is there any other workaround to handle issue-level permissions?
Maybe you are referring to the "Issue level security" term (??)
If so, you can get the issue security level name from the "security level" field attached to the issues (Use a Jira account that has an active "Set Issue Security" permission, in order to work with this system issue field). This can be done by REST API that queries issue fields.
Also, the JAVA API Interface is called: 'IssueSecuritySchemes' (at package: com.atlassian.jira.functest.framework.admin, for Jira Server/Data Center).

How to upload a new version of a task group via api?

I am trying to write some software to programmatically manage a set of TaskGroups across multiple projects. My issue is that if I have a TaskGroup with multiple published versions, I can't seem to get that update into a different project.
If I try to to just POST the updated version of the TaskGroup, I get a
Microsoft.TeamFoundation.DistributedTask.WebApi.MetaTaskDefinitionExistsException
because it detects that it has the same name as another TaskGroup.
If, however, I try to PUT the update into the existing TaskGroup, it for some reason acts like it can't find the TaskGroup with that ID (even though I have verified that it exists in that project).
Does anyone have any experience with this?
If you want to update a task group in a project, you should follow this api to update it:
PUT https://dev.azure.com/{organization}/{project}/_apis/distributedtask/taskgroups/{taskGroupId}?api-version=5.0-preview.1
If you want to use the task group in other projects, you can try to list the task group and then create a task group in new project:
List task group:
GET https://dev.azure.com/{organization}/{project}/_apis/distributedtask/taskgroups/{taskGroupId}?api-version=5.0-preview.1
Add a task group:
POST https://dev.azure.com/{organization}/{project}/_apis/distributedtask/taskgroups?api-version=5.0-preview.1

How to keep Postman collections and tests in sync with swagger/open api specs and git in a CI flow

We are investigating whether we can incorporate Postman Test Runner and Newman into an API testing flow with our Jenkins CI server.
My question is this: once I import a swagger/Open API file into a Postman collection, how can I keep changes from multiple team members in sync?
For example, if a team member adds a new api endpoint to the swagger file, do we have to re-import the swagger file into a postman collection overwriting it? We'd like to keep using the swagger file as the single source of truth so would like to keep that in sync with the postman collection. Ideally we would update the swagger file, commit it to git and get its changes synced to postman.
What about tests created in postman? Is there a way to keep that checked into git? Would we have to export the collection after each test change and check that into git, and re-import changes to postman collections after each git pull?
It looks like since some of the online postman features are built for sharing - the idea is that you would make a change to the collection directly in the postman client and that gets shared out to other postman clients? If so, is there a hook that can be added to sync those changes to git automatically?
To answer your questions in order:
Once I import a swagger/open api file into a postman collection, how
can I keep changes from multiple team members in sync?
To keep your collections in sync everyone will need to sign in and use a team workspace. As of Postman 6.2 a single team workspace is now free.
https://www.getpostman.com/docs/v6/postman/workspaces/intro_to_workspaces
For example, if a team member adds a new api endpoint to the swagger file, do we have to re-import the swagger file into a postman collection overwriting it?
Depends on how you are generating the file. If it is being generated using a run-time tool (e.g., NSwag, Swashbuckle) then you'll most likely end up needing to overwrite the file. If you have a swagger.json your team is directly maintaining, you can probably modify the scripts Postman provides to keep your definitions in sync with Postman: http://blog.getpostman.com/2018/03/02/sync-your-specs/
What about tests created in postman? Is there a way to keep that checked into git?
Yes. You can export Postman collections which include your tests and check those into Git.
If so, is there a hook that can be added to sync those changes to git automatically?
Answered on SO here.

Using Asana API to Copy a Project

Is there a way to copy an Asana project using the API, similar to the "Use as a Template (Copy Project)" functionality available in the web interface?
We use 'template' projects heavily and now we are looking to automate this process.
Thanks in advance.
Till now Asana API does not facilitate this. But still if you want to make it work, fetch your template project using Asana API and fetch the tasks too. After that create new project and paste your tasks or any other details that you want. That will make things work for you.

Resources