<?xml version="1.0" encoding="utf-8"?><finScript version="1.00" exportedUtcDate="2018-08-12T23:12:14.0000000"><CreatedUserId>ADMIN</CreatedUserId><CreatedUtcDate>2018-06-19T21:18:06.5770000</CreatedUtcDate><UpdatedUserId>ADMIN</UpdatedUserId><UpdatedUtcDate>2018-06-19T21:24:40.0600000</UpdatedUtcDate><ScriptId>WSCLIEXP</ScriptId><Description>Web Service - Client Export</Description><ScriptType>WebServiceWebApi</ScriptType><Active>true</Active><AllowUI>false</AllowUI><Category>ME</Category><Code>Option Explicit On
Option Strict On

' ######################################
' Web Service to return client accounts.
'
' Current Version: 1.00.00 (19/05/2015)
'
' Usage: Web Service API
'
' Revision Notes
' ==============
' 19/05/2015  1.00.00   ISS.ME    Created.
' ########################################

#include "FL.WSCLASS"

Public Function Main(request As finwsHttpRequest) As finwsHttpResponse

  ' Parameters:
  '   request - The HTTP request details

  Dim Client As finClient
  Dim ClientId As String
  Dim ClientIds As ISList
  Dim CustomClient As clsCustomClient
  Dim CustomClients As clsCustomClients
  Dim ErrorCode As String
  Dim ErrorStatusCode As HttpStatusCode
  Dim Ok As Boolean

  ' Assume Success
  Ok = True

  ' Initialise
  Client = finBL.CreateClient()
  ClientIds = finBL.Runtime.CreateList()
  CustomClients = New clsCustomClients()
  ErrorStatusCode = HttpStatusCode.BadRequest

  ' Validate User
  Select Case request.AuthenticatedUserType
    Case isefinwsAuthenticatedUserType.User
    Case isefinwsAuthenticatedUserType.WebAdmin
    Case Else
      Ok = False
      ErrorCode = "AuthenticatedUserType.Unauthorised"
      ErrorStatusCode = HttpStatusCode.Unauthorized
      finBL.Error.ErrorBeginFormat("This custom Web Service is not available to Authenticated User Type '{0}'.", request.AuthenticatedUserType.ToString())
  End Select

  If Ok Then
    ' Get the ClientId's from the request parameters
    ClientIds.FromCsvString(request.Parameters.GetString("ClientIds"))

    ' Loop through clients
    For Each ClientId In ClientIds
      If Client.Load(ClientId) Then
        ' Create custom client from finClient
        CustomClient = New clsCustomClient(Client)
      Else
        CustomClient = New clsCustomClient()
        CustomClient.ClientId = ClientId
        CustomClient.ErrorMessage = String.Format("Failed to load client: {0}", ClientId)
      End If

      ' Add custom client to collection
      CustomClients.Add(CustomClient)
    Next
  End If

  ' Return Response
  If Ok Then
    Return request.CreateResponse(HttpStatusCode.OK, CustomClients)
  Else
    Return request.CreateErrorResponse(ErrorStatusCode, String.Format("Failed to execute custom Web Service Script '{0}'.", ScriptInfo.ScriptId), ErrorCode, finBL.Error.Message())
  End If

End Function</Code><Language>VisualBasic</Language><Notes>Request Parameters: 
- ClientsIds: CSV list of ClientId's

e.g ClientIds=C10000,C10001</Notes><PermissionKeyExecute /><RunWithoutPrompts>false</RunWithoutPrompts><TemplateText /><TemplateTextBookmarks /><TimeoutSeconds>60</TimeoutSeconds><WebServiceName /><WebServiceAllowAnonymous>false</WebServiceAllowAnonymous><WebServiceAllowClient>true</WebServiceAllowClient><WebServiceAllowUser>true</WebServiceAllowUser><WebServiceAllowWebAdmin>true</WebServiceAllowWebAdmin><WebServiceSendDebugInformation>false</WebServiceSendDebugInformation><ParametersType>Custom</ParametersType><Parameters><ISParameterDefs version="1.00"><Parameters><Parameter name="ClientIds" type="Text"><BlankTip /><Caption>Request</Caption><StandaloneOnly>false</StandaloneOnly><TooltipText>ClientIds=C10000,C10001</TooltipText><DefaultValueExpression /><Enabled>true</Enabled><HideDescription>false</HideDescription><IndentLevel>0</IndentLevel><Mandatory>false</Mandatory><NonPersistable>false</NonPersistable><ReadOnly>false</ReadOnly><ReadOnly2>false</ReadOnly2><Value /><Visible>true</Visible><MaxLength>0</MaxLength><Rows>1</Rows></Parameter></Parameters></ISParameterDefs></Parameters></finScript>