REST endpoint registration and bootstrap(Creating range-index) using U Deploy - rest

I have my code in Git repository. I am using UDeploy to deploy my code into MarkLogic environment. I can able to move all my modules successfully but facing two problems
1. Creating New indexes
2. REST endpoint creation
Please let me know if there is anyway to implement these two
For creating indexes, I have tried to do it using API functions(admin:database-range-element-index()) and I have successful in that part. But is there any way to do it from UDeploy or DevOps.
For register REST endpoint I couldn't able to find anyway to try.

Have you looked at MarkLogic's REST Management APIs - https://docs.marklogic.com/REST/management. In particular, see if https://docs.marklogic.com/REST/POST/manage/v2/databases will help you create indexes via REST management APIs.

The most common way to deploy MarkLogic code & configuration is ml-gradle, a plugin to the widely used gradle tool. ml-gradle uses MarkLogic's Management API, mentioned by Ganesh, and is scriptable.

Related

Can I get the Swagger interface to appear on a deployed Azure web API?

When one creates an ASP.NET Core Web API in Visual Studio 2022, and tests it locally, one gets a convenient Swagger page built upon an OpenAPI definition, to test all HTTP endpoints.
However, when deployed and trying to access {path-to-api}/swagger, it returns a 404 Not Found error, even while on localhost, when both the API and the database is sitting on my own machine. Even if the database is in the Azure cloud, for that matter, it also works, if I put the Azure SQL Database connection string into appsettings.json.
So is there a way to achieve this, preferably without too much hassle? Or am I wrong in wanting this, do developers mostly test their APIs locally? Because I want the Swagger API online only for testing.
The problem is getting and using the swagger functionality into the cloud. Is it possible and good practice?
If you look at the startup, you will notice that the swagger is only loaded during a development session via an if check. Commenting that out, or expanding it based on evironment, will allow a published version to generate the page on the target host.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
I generally do that for first publishes or to Dev/Test environments to see it running. Once it is not needed, I un-comment it back in.
Also it may be actually viable (turned on) in Dev or UAT server because one is also publishing the open api it to APIM (Azure api manager), which takes the api and generates its own development environment; away from an initial publish.
Also once published, it is not the default page, one still has to path to it such as .../swagger/index.html.
I'm aborting this mission to deploy the Swagger interface to Azure along with my API. It's bad security practice to make the HTTP request methods so visually available to all. So the answer to my question do developers mostly test their APIs locally, is apparently yes.
I wondered if I should remove the question, but I would like to make it still stand, in case anyone else is contemplating about doing the same thing - exposing an API online with the Swagger UI.

Is there a way to import a Bamboo Spec file via the REST API?

I currently try to automate the process of creating a new Bamboo linked repository and start the scan. I've already looked over the documentation of the REST API, tried to generate a new plan and enabling a scan, but that didn't work.
I also tried the Java Maven Package from Atlassian, but that needs user credentials as an authentication method, whilst I need to authenticate via a Security token. There is a link to an API in that Maven Package, which I tried to send a request to with the yaml code, but it always responds with the status code 500 and a Java Stacktrace. It's probably due to a wrong request body, but I can't figure out, how to include the yaml content the same way, as the maven package.
Is there a way to create a linked repository via the REST API?
Thanks in advance!
Is there a way to create a linked repository via the REST API?
No and there won't ever be one because they're deprecating the Bamboo server in favour of their cloud-based alternative (which is based on a totally different API). See https://jira.atlassian.com/browse/BAM-18453
Java Maven Package from Atlassian
What package is that? Based on what I said earlier the only way for you to programmatically create a linked repo is to mimic the browser POST request to updateLinkedRepository.action. That means that you'll need to login first to get a JSESSIONID cookie (xsrf token can be disabled, see https://confluence.atlassian.com/bamkb/rest-api-calls-fail-due-to-missing-xsrf-token-899447048.html#RESTAPIcallsfailduetoMissingXSRFToken-Workaround). Ping me if you need help, I still have ansible code for the login part.

AzureDevOps Exporting the ProcessTemplate

We have created a process template on the Enterprise level access on Microsoft AzureDevOps platform. We were looking to export the process template so that it can imported for some other organization. However we do not find an option to do so. Can anyone help?
The only way I've found so far to export inherited processes to other organizations is to use the process-migrator tool that's on GitHub made by Microsoft. There are some wonky things about it that don't totally work but hopefully should be a good start:
https://github.com/Microsoft/process-migrator
You download and install dependencies on the tool then you can run migrate or export/import (I think I usually do export/import).
I think that it works okay as-is except for if you have work item rules that are type CurrentUserIsMemberOfGroup, and picklists don't export correctly, but you'll want to do some testing of the tooling first. I also found out recently that this tooling uses an old SDK/API version (API v4.1) so hopefully it will be updated soon.
I am not sure through Azure DevOps UI but there are methods in Azure DevOps Services REST API
Export Process Template REST API Documentation
Import Process Template REST API Documentation
Parameters are pretty straighforward and well explained in MS Documentation.

Create azure website programatically in C#

I want to create/update the websites/cloud services in Azure in C#. My objective is to deploy the website/cloud service in Azure without any user intervention.
Can anyone please help me to resolve below queries?
Can we manage Azure websites/cloud services using C# code? If yes then how (any library/api/nuget package)?
If it is not possible in C#, then what are other options to achieve this? I read WebDeploy(MsDeploy), powershell can do this work but I am not sure which one is best in this scenario and how to use them.
This completely depends on your scenario. If you have got a system to run your powershell script from, this might be a good option (https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/) You could also use the cross platform command line tools to script your deployment / web app creation. There are different other options, especially for continous deployment to a web app. You can for example connect your github repo to an existing web app and deploy from that repository.
The C# library you were looking for should be this one:
https://github.com/Azure/azure-sdk-for-net/tree/master/src/ResourceManagement/WebSite

Azure deployment versions

I will try to make it simplify. I am using windows azure cloud to host our web services and databases. and these web services are accessible via URL: "https://server.mydomain.com"
now we made a few major changes to our model and hence web services as a whole. This breaks the API interface for older users. Now we want to deploy the latest version on URL: "https://server.mydomain.com/v2" so that old users can still access the older version.
I searched around SO and other resources but i couldnt find a definite answer how to deploy new version without messing up the old version.
Anything in right direction will be helpful.
In one of the projects I was working on, we built in a versioning scheme on top of our Web API. We used this tutorial to get started. I would recommend starting there.
Sorry for the generic answer, if you post some more specifics I will make some updates.
I'd suggest to deploy separate cloud service and use "v2.server.mydomain.com"