AccountBase Address App AppRequest Authorization Building BusinessAccount Country Culture Data DataContainer DataRequestOrder ExtendedProperty ExtendedPropertyValue FileLTU FileLTUContainer FileLTURequestOrder FileStore Flux FluxContainer FluxRequestOrder InfrastructureBase InfrastructureShortBase IRequestOrderBase LTU LTUBase LTUContainer LTUeWon Message Organization Point PointGroup Preparation QuickStart ReflectionAnalogic ReflectionBase ReflectionCommandAnalogic ReflectionCommandBase ReflectionCommandDigital ReflectionCommandDuret ReflectionCommandEwon ReflectionCommandGroup ReflectionCommandGroupContainer ReflectionCommandGroupExecutionSummary ReflectionCommandGroupItem ReflectionCommandGroupPhaseSummary ReflectionCommandMultiple ReflectionCommandPlanning ReflectionCommandState ReflectionCommandSystem ReflectionCommandText ReflectionCommandUnitOfProd ReflectionContainer ReflectionDataAnalogic ReflectionDataBase ReflectionDataContainer ReflectionDataDigital ReflectionDataDuret ReflectionDataEwon ReflectionDataPlanning ReflectionDataState ReflectionDataSystem ReflectionDataText ReflectionDataUnitOfProd ReflectionDigital ReflectionEvent ReflectionEwon ReflectionFormat ReflectionGeneric ReflectionItemAnalogic ReflectionItemBase ReflectionItemDigital ReflectionItemList ReflectionItemText ReflectionParameterAnalogic ReflectionPlanning ReflectionRequestOrder ReflectionState ReflectionStateReference ReflectionSystem ReflectionTemplate ReflectionText ReflectionUnitOfProd Role RoleStatus Site User ValueAnalogic ValueBase ValueDigital ValueText WAC WBase WCAExceptionResource WDCParameter WDCService WEvent WEventCategory WEventItem WEventsContainer WEventsRequestOrder WEventType WUM WUMFunction WUMMaterial WUMType WUMUnit WUMUnitCategory WUMUnitFamily WUMUnitItem Zone
Preferred message format

Microsoft DotNet WAPI SDK


Integrate WIT-DataCenter plateform from Windows Store, Web ASP.NET or Desktop Apps

Install

Install WAPI SDK nuget package from your project. 3 assemblies are added to your .Net project:
  • WIT.DataCenter.DTOs.dll:DTOs = Data Tranfer Object = entities return by WAPI
  • WIT.DataCenter.SDK.Common.dll: portable library with WAPI Proxy
  • WIT.DataCenter.SDK.dll:custom WAPI sdk related to project type
Remark

Even if WAPI Nuget package target all .Net project types (Windows Store, Web ASP.NET or Desktop Apps), installed assemblies will be differents.

Configuration and usage depend from project type:

Windows Store App (8.1)

Configure App credentials

Configure WAPI SDK with your App credentials Your developed Apps.
Open App.xaml.cs and add row above in App() constructor replacing YOUR_APP_ID, YOUR_APP_SECRET and YOUR_APP_NAME

      public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;
            WAPIClient.Current.Initialize("YOUR_APP_ID", "YOUR_APP_SECRET", "YOUR_APP_NAME");
        }

Call WAPI Operation

You do not have to take care about WAPIToken. User autentication and autorization workflow is handled by WAPI SDK.
That's where the magic stuff occur ! if your App do not have retreived a WAPIToken for current end-user, he is automatically redirected on WIT-DataCenter Autorization Server.
Then WAPIToken is stored in Roaming Application Data for future use after App is closed.

Ex: request all your BusinessAccounts on WIT-DataCenter plateform
      // Initialize Operation
      var operation = new GetBusinessAccountsMy(updatedDate: null);
            
      // Request Operation (here BusinessAccountDto array is returned)
      var response = await WAPIHelper.RequestAsync(operation);

Asp.NET App

Configure App credentials

Configure WAPI SDK with your App credentials Your developed Apps.
Open .Config and update node client replacing YOUR_APP_ID, YOUR_APP_SECRET and YOUR_APP_NAME

client identity="YOUR_APP_ID" secret="YOUR_APP_SECRET" name="YOUR_APP_NAME"

Request a Token

  1. When end-user need to access WAPI Operation for the first time, redirect him to WIT-DataCenter autorization server
    WAPIClient.Current.RequestAuthorization()
  2. On callback, request a definitive WAPIToken for current end-user (method is async)
    var wapiToken = await WAPIClient.Current.ProcessAuthorizationAsync()
    Remark

    View OAuth doumentation for detailed Authorization Code Grant Workflow

  3. Store WAPIToken in current end-user repository for future use
    Remark

    End-user must be autenticated in your WebApp to associate WAPIToken

Call WAPI Operation

You need WAPIToken retreived with above workflow.
Ex: request all your BusinessAccounts on WIT-DataCenter plateform
      // Get WAPIToken
      IWAPIToken wapiToken = ... 
     
      // Initialize Operation
      var operation = new GetBusinessAccountsMy(updatedDate: null);
            
      // Request Operation (here BusinessAccountDto array is returned)
      var response = await WAPIClient.Current.RequestAsync(operation, wapiToken);

Refresh a Token

  1. When access_token expiration is imminent, refresh:
    await WAPIClient.Current.RefreshWAPITokenAsync()
    Remark

    View OAuth documentation for detailed OAuth 2.0 Refresh workflow

  2. Store refreshed WAPIToken in current end-user repository