Sample code for consuming Track-It! Web Api’s


Download 239.09 Kb.
NameSample code for consuming Track-It! Web Api’s
page1/9
A typeDocumentation
  1   2   3   4   5   6   7   8   9

Sample code for consuming Track-It! Web API’s


 
This document will serve as a guide on how to use the Track-It! Web API’s that were introduced in Track-It! 11.2, using a Microsoft .Net application. The Track-It! Web API supports following actions:

 



  • Login

  • Get Work Order

  • Update Work order

  • Create Work Order

  • Change Work Order Status

  • Close work order (Quick Close)

  • Add note to a work order

 

For details on individual API interfaces please refer to the below documentation:

Track-It! Web API’s can be called from any type of application like Microsoft.Net WPF application or Windows Phone 8 Application.

For the purpose of this document, let us assume we are creating a .Net C# Console Application to consume Track-It! Web API’s.


Table of Contents




Sample code for consuming Track-It! Web API’s 1

1.Installing NuGet Package Manager 2

2.Installing the Web API Client Libraries 3

3.Installing the JSON.Net Libraries 4

4.Adding the Model Class 5

5.Initializing HttpClient 6

6.    To Authenticate the User and Generate the Access Token 7

 Code Snippet for Login as an Administrator: 8

7.    Get Work Order 9

Code Snippet for Get WorkOrder with ID 340 for Example: 10

8.    Update work order 11

Code Snippet for Update WorkOrder with ID 340 for Example: 11

9.    Create Work Order 13

Code Snippet for Create WorkOrder: 13

10.    Change status of the Work Order 15

Code Snippet for ChangeStatus of WorkOrder with ID 340 for Example: 15

11.    Close work order (Quick Close) 17

Code Snippet for Close WorkOrder: 17

12.    Add note to a work order 19

Code Snippet for AddNote to WorkOrder with ID 340 for Example: 19

13. Treating error codes as an Exception 21

14. De-serializing data using Dictionary Class object 22

APPENDIX A - Object Definitions 22

A1. Return-Token definition 22

A2. WorkOrder Object definition - 01 22

A3. WorkOrder Object definition – 02 24

A4. Note Object definition 25

APPENDIX B – Error Codes 26


  1. Installing NuGet Package Manager


After Creating New Console Application, Install NuGet Package Manager. This is the easiest way to add the Web API Client library to a project. If you do not have NuGet Package Manager already installed, install it as follows.



  1. Start Visual Studio.

  2. From the Tools menu, select Extensions and Updates.

  3. In the Extensions and Updates dialog, select Online.

  4. If you don't see "NuGet Package Manager", type "nuget package manager" in the search box.

  5. Select the NuGet Package Manager and click Download.

  6. After the download completes, you will be prompted to install.

  7. After the installation completes, you might be prompted to restart Visual Studio.


c:\users\sburde\desktop\capture.png
  1. Installing the Web API Client Libraries



HttpClient is a modern HTTP client for .NET. It provides a flexible and extensible API for accessing all things exposed through HTTP. HttpClient has been available for a while as part of WCF Web API preview 6 but is now shipping as part of ASP.NET Web API and in .NET 4.5.
To use HttpClient class, Add the Web API Client Libraries package to your Project.

Details for Installing Web API Client Libraries package is given below.



  1. From the Tools menu, select Library Package Manager. Note: If do you not see this menu item, make sure that NuGet Package Manager installed correctly.

  2. Select Manage NuGet Packages for Solution...

  3. In the Manage NugGet Packages dialog, select Online.

  4. In the search box, type "Microsoft.AspNet.WebApi.Client".

  5. Select the package named "Microsoft ASP.NET Web API Client Libraries".

  6. Click Install.

  7. After the package installs, click Close to close the dialog.


c:\users\sburde\desktop\capture2.png


  1   2   3   4   5   6   7   8   9

Share in:

Related:

Sample code for consuming Track-It! Web Api’s iconThis section lists a sample code that will help you get started in...

Sample code for consuming Track-It! Web Api’s iconWhat is Web api and why to use it ?

Sample code for consuming Track-It! Web Api’s iconCreating Web api using asp. Net mvc 6

Sample code for consuming Track-It! Web Api’s iconMicrosoft exchange web services managed api 1

Sample code for consuming Track-It! Web Api’s iconAsp net core 0 mvc 6 using web api and AngularJs

Sample code for consuming Track-It! Web Api’s iconAbstract The SkeletalViewer sample demonstrates the use of the natural...

Sample code for consuming Track-It! Web Api’s iconAsp net web Forms – Sample Exam – September 2013 Poll System in asp net web Forms

Sample code for consuming Track-It! Web Api’s iconI’m a full-stack web developer with a focus on front-end development....

Sample code for consuming Track-It! Web Api’s iconWeb Developer Resume Sample

Sample code for consuming Track-It! Web Api’s iconSample Web Developer Resume




forms and shapes


When copying material provide a link © 2017
contacts
filling-form.info
search