Git Product home page Git Product logo

dotnetapilib's Introduction

Hornbill .NET / C# API Lib

Integration

Various Hornbill Integration methods are documeted here: https://wiki.hornbill.com/index.php/Integration

DLLs

espapi_dotnet.dll Only supports .Net Framework v4.0 and above.

The DLLs can be found here: https://github.com/hornbill/dotNetApiLib/tree/master/EspApiLib/espapi_dotnet/bin/Release

Logging in

Using Hornbill API's required an authenticated session the first way to create a session it to call session::userlogon

//-- Initiate Class
xmlmc = new XmlmcService("instanceName", "xmlmc", "dav", string.Empty);

// Username
xmlmc.AddParam("userId", "admin");
//-- Password must be base64 encoded
xmlmc.AddParam("password", "password").EncodeValue(XmlmcEncoding.Base64);

//-- Invoke session::userLogon
xmlmc.Invoke("session", "userLogon");

//-- Get SessionId from the API Response
string sessionId = xmlmc.GetResponseParamAsString("sessionId");

Using API Keys

An Alternative method for logging into Hornbill is to use API Keys these are associated to users in the Administration Tool and are passed with every API Call removing the need to login.

//-- Initiate Class
xmlmc = new XmlmcService("instanceName", "xmlmc", "dav", string.Empty);

//-- Set API Key
xmlmc.APIKey = "MyAPIKeyHere";

//-- Invoke session::getSessionInfo
xmlmc.Invoke("session", "getSessionInfo");

//-- Get SessionId from the API Response
string sessionId = xmlmc.GetResponseParamAsString("sessionId");

Example C# Application

An Example C# Application has been provided here: https://github.com/hornbill/dotNetApiLib/blob/master/CSharpExample

Functionality Includes

  • Login
  • Logout
  • Get List of Requests
  • Log a Request
  • User API Keys

The following file needs to be updated to include your instance details:

https://github.com/hornbill/dotNetApiLib/blob/master/CSharpExample/MainWindow.xaml.cs

These strings need to be updated:

private readonly string instanceName = ""; //-- Instance Name
private readonly string userId = ""; //-- UserName
private readonly string password = ""; //-- Password
private readonly string apiKey = ""; //-- API Key

dotnetapilib's People

Contributors

trevor-hornbill avatar andre-hornbill avatar

Watchers

Ben avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.