Call API from Python

import requests
import urllib3

# suppress the HTTPS warnings in terminal
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

# BEGIN
session = requests.Session()
session.verify = False

url = "https://some.url.com?param1=something&param2=something"
headers = {'content-type': 'application/json', 'Accept-Charset': 'UTF-8'}

# call the HTTP endpoint
httpResult = session.get(url, headers=headers)
print(httpResult.text)

# some extra details
elapsedSeconds = httpResult.elapsed.total_seconds()
statusCode = httpResult.status_code

Get user credentials securely in PowerShell

#Get user credentials securely
Try {
	$credentials = Get-Credential "$env:username"
}
Catch {
	$log += "`n- " + $_.Exception.Message
	Output-Result
}

#Get current domain to use for authentication. ADSI = Active Directory
$currentDomain = "LDAP://" + ([ADSI]"").distinguishedName

#Authenticate
$activeDirectoryEntry = New-Object System.DirectoryServices.DirectoryEntry($currentDomain,$credentials.GetNetworkCredential().UserName,$credentials.GetNetworkCredential().Password)
if ($activeDirectoryEntry.name -eq $null)
{
    $log += "`n- Failed to authenticate that username and password."
    Output-Result	
} else {
    $log += "`n- Authentication was successful."
}

#Display Results
$log = "Results:"
function Output-Result {
    [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") > null
    $oReturn=[System.Windows.Forms.Messagebox]::Show($log)
    Break
}

Startup.cs example for .NET Core API w/ Swagger

using Swashbuckle.AspNetCore.Swagger;

public void ConfigureServices(IServiceCollection services)
{
    services.AddMvcCore().AddApiExplorer();
    services.AddSwaggerGen();
    services.AddSwaggerGen(c =>
    {
        c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" });
    });

    services.AddTransient<ISomeInterface, SomeDependency>();
}



// -----------------

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    if (env.IsDevelopment())
    {
        app.UseDeveloperExceptionPage();
        app.UseSwagger();
        app.UseSwaggerUI(c =>
        {
            c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API");
        });
    }
    app.UseMvc();
}