Skip to main content

ServiceApi Usage

Required Libraries

using System; using Bimser.Synergy.ServiceAPI; using Bimser.Synergy.ServiceAPI.Models.Authentication; using Bimser.Synergy.Entities.Shared.Business.Objects; using Newtonsoft.Json;

Codes

protected LoginWithTokenAuthenticationParameters Credentials         {             Get             {               return new LoginWithTokenAuthenticationParameters                 {                     EncryptedData = _workflowData.Context.EncryptedData,                     Language = _workflowData.Context.Language,                     Token = _workflowData.Context.Token                 };             }         }         internal static HttpClientOptions _httpClientOptions;         internal static string WebInterfaceUrl         {             Get             {                 if (_httpClientOptions == null)                 {                     string envVar = Environment.GetEnvironmentVariable("HTTP_CLIENT_OPTIONS");                     _httpClientOptions = JsonConvert.DeserializeObject<HttpClientOptions>(envVar);                 }                 return _httpClientOptions.WebInterfaceUrl;             }         }

private ServiceAPI _serviceApi;         protected ServiceAPI ServiceApi         {             Get             {                 if(_serviceApi == null)                 {                     _serviceApi = new ServiceAPI(Credentials,WebInterfaceUrl);                 }

                

return _serviceApi;             }         }

Example Usage

With the following code, as an example, a process can be created with ServiceApi.

ServiceApi.WorkflowManager.Create("projectName","flowName");