I need to create Team Foundation Server projects, but the only way I can find to do it is manually through the website.
Is it possible to do programmatically via a CLI, programming language, or RESTful API?
Thanks in advance.
Is it possible to do programmatically via a CLI, programming language,
or RESTful API?
It's possible, you can do that using Rest API. Azure Devops Server 2019 and TFS 2018U2 both support creating project using Rest API. TFS2018U2, Azure Devops Server.
More details please refer to this document.
Test with TFS2018U2 in PostMan:
Request URL: https://ServerName:8080/tfs/CollectionName/_apis/projects?api-version=4.1
Request Body:
{
"name": "CreateProjectTest",
"description": "Just for Test",
"capabilities": {
"versioncontrol": {
"sourceControlType": "Git"
},
"processTemplate": {
"templateTypeId": "6b724908-ef14-45cf-84f8-768b5384da45"
}
}
}
If you get status 202 accepted, then you can see the newly created project in website after some time (For me,10~25 seconds).
Note: The document states the format is https://{instance}/{collection}/_apis/projects?api-version=xxx, but you need to use http instead of https when you Public URL starts with http:
In addition: Here's one similar issue to achieve what you want using CLI. And here's another one that may give you some hint if you want to do that using C# code.
Hope all above helps :)
Related
I have Visual Studio 2019 16.10.4 and Azure Logic Apps Tools for Visual Studio 2019 2.24.2
I have created a Logic App by first going to the portal and getting a simple skeleton trigger that listens on an Event Grid Topic and connects using a Managed Identity.
I then copy the json over to my Visual Studio project.
Once in Visual Studio if I deploy the ARM template (note I deploy the ARM template using a simple powershell script and not the one generated by the tool but that should not matter) everything works as I expect, I get the API Connection, Logic App, and Event Grid Trigger all created so I am happy that the contents of the ARM template and parameters file all work as I expect.
The issue I face is that when I open the Logic App in the Logic App designer the tool seems to remove the managed identity code from the json and then the tool spits out an error in the output window.
If I can try to explain.
This is the code in the raw json file before I open in the designer:
"$connections": {
"value": {
"azureeventgrid": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('LogicAppLocation'), '/managedApis/', 'azureeventgrid')]",
"connectionId": "[resourceId('Microsoft.Web/connections', parameters('azureeventgrid_1_Connection_Name'))]",
"connectionName": "[parameters('azureeventgrid_1_Connection_Name')]",
"connectionProperties": {
"authentication": {
"type": "ManagedServiceIdentity"
}
}
}
}
}
When I open in the designer I see this error message in the Output window:
The workflow connection parameter 'azureeventgrid' is not valid. The API connection 'azureeventgrid' is configured to support managed identity but the connection parameter is either missing 'authentication' property in connection properties or authentication type is not 'ManagedServiceIdentity'.
And then when I look at the raw json this is what now appears:
"$connections": {
"value": {
"azureeventgrid": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('LogicAppLocation'), '/managedApis/', 'azureeventgrid')]",
"connectionId": "[resourceId('Microsoft.Web/connections', parameters('azureeventgrid_1_Connection_Name'))]",
"connectionName": "[parameters('azureeventgrid_1_Connection_Name')]"
}
}
}
}
So it appears as if the tool is not happy with some part of my code and removes it.
I then do my work, close the designer, open the raw json, copy back in the removed connectionProperties and deploy. So I do have a workaround but it is a bit tedious to have to do this all the time.
Is this a known issue? For example I can see that the designer does not seem to allow me to create a logic app with a trigger to event grid that uses Managed Identity (hence why I started out by creating a skeleton in the portal and copying the code over).
I have backend system in Web API using asp.net core where I am using Swashbuckle.AspNetCore package for generating OpenAPI Specification document. The OpenAPI specification document is generating fine something like '~/swagger.json'. I hookup this url in APIM via OpenAPI specification it works like a charm.
However if the '~/swagger.json' gets updated due to adding new operation,documentation and so on. The changes are not getting reflected in APIM. How can I solve this problem?
If APIM is not able to detect the changes automatically then can I mention the url '~/swagger.json' in ARM template something like that and while doing complete deployment of the APIM for e.g.in other or higher environment the spec gets reflected there. I also tried to download the ARM template from portal I was not able to see a place where I can specify '~/swagger.json' url.
There is option from UI to import spec again but any easy automated way of doing this would be appreciated
Ues PUT /apis/... call in Azure APIM rest API and specify below as payload:
{
"properties": {
"format": "swagger-link-json",
"value": "https://contoso.com/swagger.json"
}
}
Docs: https://learn.microsoft.com/en-us/rest/api/apimanagement/2019-12-01/apis/createorupdate#contentformat
I am pulling a file from on premise TFS source control using the Rest API. I can't find on premise specific documentation, but it seems to be very close to version 4.1 of the Azure Get Item call. According to this documentaiton, it should return a TfvcItem object which has a lot of metadata including the version. However, when I make the call it only returns the file contents (the content field of the documentation's TfvcItem).
How do I get the current version of the file?
I need the version when I check itin with create changeset. I don't need it for any other reason, so if you know another way to check in an edited file that would help.
Instead of using Get Item API, some related REST APIs are not documented. For these REST APIs we can use tools such as Fiddler or directly press F12 - network in Chrome to track them.
You should use below API to fetch latest changeset version of a file:
post https://dev.azure.com/{organizationname}/{Projectname}/_api/_versioncontrol/history?__v=5
For body:
{"repositoryId":"","searchCriteria":"{\"itemPath\":\"$/MyFirstProject/Main/1.txt\",\"itemVersion\":\"T\",\"top\":50}"}
itemPath is your server path of the file.
From the response, you will get the version info such as "version": "139", instead of the file content.
Not sure your detail version of TFS, I was using Azure DevOps Service for an example. There maybe some difference for different TFS version. You could track the detail API on your own side.
More detail info kindly take a look at this question: VSTS Release API Documentation
Had the same issue. You can get item metadata by specifying "scopePath" URI parameter, instead of "path". Microsoft example in API documentation seems incorrect, as it indeed returns only item content: https://learn.microsoft.com/en-us/rest/api/azure/devops/tfvc/items/get?view=azure-devops-rest-6.0#get-item-metadata-and/or-content-for-a-single-item.
I am running JIRA 6.1 and I'm trying to use the API to create a new project. Since JIRA 6.1's Rest API doesn't support creating a project I'm using the Soap API.
Note I'm doing this using the Atlassian .net SDK, but I imagine the solution is irrelevant to that.
I have managed to create the project no problem, but I am now trying to set the following schemes in the project
Issue Type
Workflow
Screens
As far as I can tell the 6.1 Soap API (and the 7 Rest API) doesn't actually allow you to modify these schemes, only allowing you to set the Permission, Security and Notification schemes - https://docs.atlassian.com/jira/REST/latest/#api/2/project-createProject
Is that the case or am I missing something?
If it is possible to set the scheme's I want, does anyone have any examples I could base my work off?
Thanks
Got an answer from Atlassian support, and as I suspected this isn't possible.
No, you're correct, the SOAP and REST APIs do not have those
functions.
You're going to need to write type-2 add-ons to provide the functions
you need if you're going to do this remotely, but with the caveat that
if you're willing to do that, you will probably find it a lot easier
to simply write add-ons that do all the work instead of just providing
the external hooks. (Let's put it this way - I was able to code
post-functions to create an entire customised project for JIRA 4 in a
couple of days. Versus a week to add a single SOAP call for feeding
back some simple user data)
I won't mutter too much about using SOAP - I'm assuming you know it's
dead, gone and mostly pointless to code for
Of course, there is the CLI plug-in which I think I'd be silly to ignore
JIRA Command Line Interface (CLI) support this for 6.1 through 7.0
including setting schemes that are not supported by SOAP or REST
except for screens. See the createProject action for details of what
is supported.
Starting from Jira 7.0.0, we can use Create project REST API [POST /rest/api/2/project]
which also allows setting following schemes while creating the project,
issueSecurityScheme
permissionScheme
notificationScheme
workflowSchemeId
Sample Request Payload:
{
"key": "EX",
"name": "Example",
"projectTypeKey": "business",
"projectTemplateKey": "com.atlassian.jira-core-project-templates:jira-core-project-management",
"description": "Example Project description",
"lead": "Charlie",
"url": "http://atlassian.com",
"assigneeType": "PROJECT_LEAD",
"avatarId": 10200,
"issueSecurityScheme": 10001,
"permissionScheme": 10011,
"notificationScheme": 10021,
"workflowSchemeId": 10031,
"categoryId": 10120
}
For issuetype and screen schemes, there is no such parameter available which can be set using the above create project rest api.
You can also try to use the following Rest endpoint to create jira project using shared configuration which will allow you to reuse all schemes which are present in the template project.
/rest/project-templates/1.0/createshared/{{projectid}}
More information on the Jira rest API can be found at https://docs.atlassian.com/software/jira/docs/api/REST/8.9.0/#api/2/project-createProject
You can try the following curl request for creating jira project
curl -D- \
-u admin:sphere \
-X POST \
-H "X-Atlassian-Token: nocheck" \
-H "Content-Type: application/x-www-form-urlencoded" \
"http://localhost:port/rest/project-templates/1.0/templates?projectTemplateWebItemKey=com.atlassian.jira-legacy-project-templates%3Ajira-blank-item&projectTemplateModuleKey=com.atlassian.jira-legacy-project-templates%3Ajira-blank-item&name=SECOND+Create+from+REST+API&key=CFRAPI&lead=admin&keyEdited=false"
I've got ServiceStack working nicely on the server and with a Windows test client, and now need to get it working in my Mono For Android application.
I've downloaded the following:
ServiceStack.Common.dll
ServiceStack.Interfaces.dll
ServiceStack.Text.dll
from the github tip, and added references to these in my Mono for Android project.
However, we need to use authentication, so need the ServiceStack.ServiceInterface.Web namespace to be available for the client, so I can do the following:
var c = new JsonServiceClient("http://localhost:53434");
var authResponse = c.Get(new Auth { UserName = "myusername", Password = "password", RememberMe = true });
Looking at my working test client, Auth is defined in ServiceStack.ServiceInterface.dll, so presumably I need to get hold of this DLL, or its source and compile it in my project.
Am I on the right lines here, or is there a simpler way to set things up? I've searched around but can't find a good resource on how to use ServiceStack with Mono For Android - if there is one, please feel free to point me to it!
I note this StackOverflow indicates I'm on the right lines - all I might need is ServiceStack.ServiceInterface.dll compiled for Mono For Android.
James
You shouldn't have to compile the server ServiceStack.ServiceInterface.dll for use in any client library as there is a copy of the Auth DTOs is also available in the ServiceStack.Common.dll client library at ServiceStack.Common.ServiceClient.Web.AuthDtos.cs.
This is possible since both server and client DTOs generate the same wireformat.