With the MessageLog endpoint you can post information from events in your integration so that is is visible in Handyman Office. This can be error messages from the integration or logging of data transfer events. This will be valuable information for support personell and customers to evaluate the flow of data in an integration.
Introduction
The message log can consist of single messages or multiple messages connected in a "session". The basic structure for one logging session is:
- Header record
- This is a record with “sequence” = 0
- The “sessionid” used for this record must also be used in the subsequent messages
- n messages connected to the same session
- “sequence” > 0 (Usually it is increased by 1 for each message. This is used to sort the messages in the UI)
- If we get an error from HMAPI or CW API we must log them as errors or warnings.
SessionID format
SessionID can be any numeric decimal value, but we are using this format internally to make a unique value:
-<yy><MM><dd>.<HH><mm><ss><fff> (fff is milliseconds)
Example: -221009.122455879
Example code in C#
string sessionId = DateTime.Now.ToString("-yyMMdd.HHmmssfff");
return double.Parse(sessionId, CultureInfo.InvariantCulture)
The MessageLog endpoint takes an array of messages. If you don’t provide a sessionId, the API will create one and use it on all elements in the array. If you want to log additional error messages to the same session, you must create you own sessionId as described above and send it with all the messages.
Values in MessageID field
The message id has en enum that will result in different icons connected to the message in the Handyman Office UI.
ProgramError = 1
Warning = 2
OrderEvent = 3
Communication = 4
DebugMessage = 5
SyncOk = 6
Store = 7
Database = 8
ProgramErrorInfo = 9
Customer = 10
SalaryCode = 11
ItemPackage = 12
Wholesaler = 13
PurchaseOrder = 14
Employee = 15
Settings = 16
Groups = 17
Dictionaries = 18
CheckLists = 19
Printouts = 20
ToBackoffice = 21
FromBackoffice = 22
Appointment = 23
ItemNumberType = 24
TimerEvent = 25
Quote = 26
AutomaticCopy = 27
AutomaticEmail = 28
AutomaticPrint = 29
PDFGenerated = 30
The most common for header records is 21 and 22 (Export, Import)