- 2 minutes to read

Manage the Nodinite Web API

Tired of writing documentation? Create it instead part of your DevOps experience You can use the Nodinite Web API to automate just about everything related with Nodinite like adding/modifying artifacts like an Integration to the Repository part of your DevOps routine. You can use just about any programming language to call the Rest based operations.

TIP: Use automation to get the documentation in place and up to date part of your DevOps experience

Programming language Description
Powershell
C#
Java
node-js

Powershell

You can easily use the Invoke-RestMethod to call any method in the Web API.

$nodiniteBaseUrl = "http://localhost/Nodinite/Demo/WebAPI"
$nodiniteBaseApiUrl = "$($nodiniteBaseUrl)/api"

$getResponse = ""
$url = "$($nodiniteBaseApiUrl)/integrations"
$getResponse = Invoke-RestMethod -Uri $url -Method Get -UseDefaultCredentials
$getResponse.Collection.Items[0].Data.IntegrationId

Example to retrieve the first Integration Id in the list of defined Integrations

C#

using Newtonsoft.Json.Linq;
using System;
using System.Net;
using System.Text;

namespace ConnectWebAPI
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var client = new WebClient { UseDefaultCredentials = true })
            {
                client.Headers.Add(HttpRequestHeader.ContentType, "application/json; charset=utf-8");
                byte[] responseBody = client.DownloadData("http://localhost/Nodinite/Demo/WebAPI/api/integrations");
                var jsonBody = JObject.Parse(Encoding.ASCII.GetString(responseBody));
                var firstIntegration = jsonBody.SelectToken("Collection.Items[0].Data.IntegrationId");
                Console.WriteLine(firstIntegration);
            }
        }
    }
}

Java

node-js

// This example uses httpntlm (https://www.npmjs.com/package/httpntlm)
// Run: "npm install httpntlm --save" before running this script.

var httpntlm = require('httpntlm');
var url = 'http://localhost/Nodinite/Demo/WebAPI/api/integrations';

httpntlm.get({
  url: url,
  username: '{YourWindowsUsername}',
  password: '{YourWindowsPassword}'
}, function (err, res) {
  if (err) return err;

  var jsonBody = JSON.parse(res.body);
  var firstIntegration = jsonBody.Collection.Items[0].Data.IntegrationId;

  console.log(`First Integration Id: ${firstIntegration}`);
});

Example to retrieve the first Integration Id in the list of defined Integrations

Your password should be protected, do use the Pre-Encrypt passsword feature in a real-world scenario


Next Step

Log API