GetUser
Security service 1.2: Returns the calling user's employee ID, initials, name, UI language and roles.
| Service | Security 1.2 |
| Endpoint | POST https://app{server-number}.timelog.com/{account}/WebServices/Security/V1_2/SecurityServiceSecure.svc |
| SOAPAction | GetUserRequest |
| Content-Type | text/xml; charset=utf-8 |
| Authentication | A token from GetToken |
| Permissions | No privilege is needed and none is checked. Nothing about other users is reachable: there is no user parameter. |
| Changes data | No |
| Safe to retry | Yes |
How it works
"Who am I" for a token. Returns one User: the employee ID, initials, first and last name, UI language and security roles. It takes no user argument and cannot read anyone else. Useful right after GetToken to confirm the integration user and to obtain its EmployeeID / initials for operations that need them.
Parameters
Each parameter has one label: Required, Conditional (required depending on other values) or Optional. Send them in the order shown.
The token from GetToken: Initials, Expires and Hash, sent back unchanged.
Request
POST /{account}/WebServices/Security/V1_2/SecurityServiceSecure.svc HTTP/1.1
Host: app{server-number}.timelog.com
Content-Type: text/xml; charset=utf-8
SOAPAction: "GetUserRequest"
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:security="http://www.timelog.com/api/tlp/v1_2">
<soapenv:Body>
<security:GetUser>
<security:token>
<security:Initials>{Initials from GetToken}</security:Initials>
<security:Expires>{Expires from GetToken, unchanged}</security:Expires>
<security:Hash>{Hash from GetToken}</security:Hash>
</security:token>
</security:GetUser>
</soapenv:Body>
</soapenv:Envelope>
curl -X POST "https://app{server-number}.timelog.com/{account}/WebServices/Security/V1_2/SecurityServiceSecure.svc" \
-H "Content-Type: text/xml; charset=utf-8" \
-H 'SOAPAction: "GetUserRequest"' \
--data-binary @request.xml
import requests
URL = "https://app{server-number}.timelog.com/{account}/WebServices/Security/V1_2/SecurityServiceSecure.svc"
SOAP_ACTION = '"GetUserRequest"'
envelope = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:security="http://www.timelog.com/api/tlp/v1_2">
<soapenv:Body>
<security:GetUser>
<security:token>
<security:Initials>{Initials from GetToken}</security:Initials>
<security:Expires>{Expires from GetToken, unchanged}</security:Expires>
<security:Hash>{Hash from GetToken}</security:Hash>
</security:token>
</security:GetUser>
</soapenv:Body>
</soapenv:Envelope>"""
response = requests.post(
URL,
data=envelope.encode("utf-8"),
headers={"Content-Type": "text/xml; charset=utf-8", "SOAPAction": SOAP_ACTION},
timeout=60,
)
result = parse_result(response) # see "Responses and errors"
{…} placeholder with your own value.Response
The call returns the standard response envelope. Check ResponseState first: a failed call still returns HTTP 200.
Success, Invalid or Error.
0 on success, otherwise the error code. See Errors.
Response<User>: Return holds one User - the context user after authentication. ResponseState Success; only the 'Duration of call' message. Success with an empty Return only if no current user can be resolved after a successful authentication - not expected.
Example response
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetUserResponse xmlns="http://www.timelog.com/api/tlp/v1_2">
<GetUserResult xmlns:a="http://www.timelog.com/api/tlp/v1_1"
xmlns:b="http://www.timelog.com/api/tlp/v1_2"
xmlns:c="http://schemas.datacontract.org/2004/07/TimeLog.TLP.Security"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:Return>
<b:User>
<b:ID>1001</b:ID>
<b:Initials>ABC</b:Initials>
<b:FirstName>Example first</b:FirstName>
<b:LastName>Example last</b:LastName>
<b:LanguageID>1001</b:LanguageID>
<b:Roles>
<c:RoleTypes>ExternalContractor</c:RoleTypes>
</b:Roles>
</b:User>
</a:Return>
<a:ReturnTypeDescription>User</a:ReturnTypeDescription>
<a:Request>…</a:Request>
<a:ResponseState>Success</a:ResponseState>
<a:Messages>
<a:APIMessage>
<a:Message>Duration of call was 0,0421337 sec.</a:Message>
<a:Severity>Message</a:Severity>
<a:ErrorCode>0</a:ErrorCode>
</a:APIMessage>
</a:Messages>
<a:ErrorCode>0</a:ErrorCode>
</GetUserResult>
</GetUserResponse>
</s:Body>
</s:Envelope>
Request block is shortened.Errors
All errors come back with HTTP 200: check ResponseState, ErrorCode and Messages. The errors every operation can return (expired or invalid token, API not enabled, HTTPS required, general errors) are listed once in Responses and errors.
This operation has no errors of its own beyond the shared ones.