WCF Account

This documentation provides details on how to interact with the WCF Account API. Ensure you have the necessary API keys and tenant information before proceeding.

Getting Started

License

In order to run WCF Account API the Totalview license Salary and Project API is required.

Build your API call

Your API call must include the following components:

  1. Host: The host for Account API Requests is https://TENANTNAME.totalview.cloud/ACCWCFAPI.

  2. Authorization header: Include the API Key in the header as x-api-key.

  3. Request type: Use POST method to submit JSON payload data.

Locate your API key

The API key is registered in the TimeServer.exe.config file in the installation directory of the TimeServer.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    ...
    <appSettings>
        ...
        <add key="WCFAccountApiKey" value="YOUR_API_KEY"/>
        ...
    </appSettings>
    ...
</configuration>

Note

The API key can be changed without needing to restart the TimeServer.

Test if connection can be established

Run this url in the browser (or with any GET request) and verify the response Hello World.

https://TENANTNAME.totalview.cloud/ACCWCFAPI/hello?msg=World

Get basic data

Note

Replace TENANTNAME and YOUR_API_KEY with your actual tenant name and API key.


Get a list of Users

To get a list of users from the API:

curl --location 'https://TENANTNAME.totalview.cloud/ACCWCFAPI/GetUsers' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '
'

Request

Empty

Response

Will return a list of TRSAccountUsers.

TRSAccountUser

  • RecID int - the Id of the user

  • ShortName string - The short name of the user

  • Name string - The name of the user

  • CustomFields TRSCustomField[] - A list of customfields the user has

TRSCustomField

  • Caption string - The custom filed caption (e.g. Capability)

  • Values string - The value of the custom field (e.g. Developer)


Get a list of approved users

To get a list of approved users from the API:

curl --location 'https://TENANTNAME.totalview.cloud/ACCWCFAPI/GetApprovedUsers' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "FromDate": "\/Date(1262304000000)\/",
    "ToDate": "\/Date(1577836800000)\/"
}
'

Request

  • FromDate DateTime - note: this field must be set to unix time in milliseconds

  • ToDate DateTime - note: this field must be set to unix time in milliseconds

Response

Will return a list of TRSAccountUsers.

TRSAccountUser

  • RecID int - the Id of the user

  • ShortName string - The short name of the user

  • Name string - The name of the user

  • CustomFields TRSCustomField[] - A list of customfields the user has

TRSCustomField

  • Caption string - The custom filed caption (e.g. Capability)

  • Values string - The value of the custom field (e.g. Developer)



Export of Records

These are methods for exporting records to account systems. These are the states account records can be before calling methods

../../../_images/wcf-account-states.png

Note

Replace TENANTNAME and YOUR_API_KEY with your actual tenant name and API key.


Get a list of account records

To get a list of account records for a given list of user ids from the API:

curl --location 'https://TENANTNAME.totalview.cloud/ACCWCFAPI/GetAccountRecords' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "FromDate": "\/Date(1262304000000)\/",
    "ToDate": "\/Date(1577836800000)\/",
    "UserRecIDs": [
        {
            "RecID": 115
        },
        {
            "RecID": 124
        }
    ],
    "ExcludeEmptyAttachments": false
}
'

Request

  • FromDate DateTime - note: this field must be set to unix time in milliseconds.

  • ToDate DateTime - note: this field must be set to unix time in milliseconds.

  • UserRecIDs - A list of TRSAccountRecID. If empty all users are taken.

  • ExcludeEmptyAttachments - true if you want to exclude empty attachments.

TRSAccountRecID

  • RecID int - The Id of a user

Response

Will return TRSAccountRecords.

TRSAccountRecords

  • TransactionKey int - The Transaction Key that will be used for handling the transaction.

  • UserRecords TRSAccountUserRecord[] - List of account records

TRSAccountUserRecord

  • UserRecID int - The Id of the user.

  • RecID int - The Id of the account record.

  • CountDate DateTime - The date the account record is for.

  • TimeStart DateTime - The datetime the record started.

  • TimeEnd DateTime - The datetime the record ended.

  • Duration int - The total duration in seconds.

  • BalanceName string - The name of the balance.

  • Attachment string - The attachment in XML.

  • Description string - The decription of the registration that resulted in this account record.


Export records for a transaction

To export records for a transaction in the API:

curl --location 'https://TENANTNAME.totalview.cloud/ACCWCFAPI/ExportRecords' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "TransactionKey" : "197"
}
'

Request

  • TransactionKey int - The transaction key given by GetAccountRecords

Response

Will return a boolean true or false based on if the export was successful.


Post records for a transaction

To post records for a transaction in the API:

curl --location 'https://TENANTNAME.totalview.cloud/ACCWCFAPI/PostRecords' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "TransactionKey" : "197"
}
'

Request

  • TransactionKey int - The transaction key given by GetAccountRecords

Response

Will return a boolean true or false based on if the post was successful.


Rollback records for a transaction

To rollback records for a transaction in the API:

curl --location 'https://TENANTNAME.totalview.cloud/ACCWCFAPI/RollbackRecords' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "TransactionKey" : "197"
}
'

Request

  • TransactionKey int - The transaction key given by GetAccountRecords

Response

Will return a boolean true or false based on if the rollback was successful.


Delete records for a transaction

To delete records for a transaction in the API:

curl --location 'https://TENANTNAME.totalview.cloud/ACCWCFAPI/DeleteRecord' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "PaymentRecordID" : "197"
}
'

Request

  • PaymentRecordID int - The account record id to delete

Response

Will return a boolean true or false based on if the delete was successful.