Login Service
UKG Pro Web Services API Guide
Login Service
Login Service API
The UKG Pro Login Service API enables the user to authenticate their UKG Pro credentials in order to retrieve an authentication token. The authentication token is used to consume the UKG Pro web services to retrieve or update UKG Pro data.
Introduction
With UKG’s UKG Pro Web Services, you can leverage your UKG Pro data for solving business application and integration needs.
This document is intended for individuals who are familiar with software development and web service technologies.
Overview
This document describes the methods of the service and provides code examples using Microsoft’s Visual Studio 2008 with C# and XML (.NET Framework 3.0 or higher).
The following information describes the service requirements.
Service Specifications
- Protocol: Simple Object Access Protocol (SOAP) 1.2
- SSL Support: Required
Signup and Licensing
Account Required: One of the following is required:
- UKG Pro Web User with Web Services permissions
- UKG Pro Service Account
Using a UKG Pro Service Account is recommended. For information regarding establishing and maintaining a UKG Pro Service Account, refer to the Manage Service Accounts guide located in the UKG Pro Learning Center (Home > Content > System Management > Web Services).
Quick Start
This section provides steps for creating a sample application in your development environment to retrieve the authentication token.
Prerequisites
In order to use the service, you will need the following items:
- A UKG Pro Service Account username and password or a UKG Pro Web User username and password
- The Customer API key from the UKG Pro Web Service administrative page
If you use a UKG Pro Service Account:
- You will need the User API key from the Service Account administrative page.
- You must have appropriate permissions granted to the Service Account on the Service Account administrative page for the services you plan to use.
If you use a UKG Pro Web User account:
- You will need the User API key from the Web Service administrative page.
C# Example
Generate the Service Reference
Once you have a user and API keys, you need to create a service reference to the Login Service. In your development environment, add the service reference to the Login Service.
In Visual Studio, select the Add Service Reference menu item from the Project menu. Once you enter the service information, you should have the reference displayed in the Solution Explorer.
Created service reference
Example C# Code
The following code is an example of authenticating to your UKG Pro data in a console application. You can copy the entire contents to a C# console application and update the following values and have an operable application.
UserName = "YOUR SERVICE ACCOUNT OR WEB USER NAME ",
Password = "YOUR PASSWORD",
UserAPIkey = "YOUR USER API KEY",
CustomerAPIkey = "YOUR CUSTOMER API KEY"
namespace ConsoleSample
{
using System;
using System.ServiceModel;
using System.ServiceModel.Channels;
using ConsoleSample.LoginService;
public class Program
{
internal static void Main(string[] args)
{
// Setup your user credentials:
const string UserName = "";
const string Password = "";
const string UserApiKey = "";
const string CustomerApiKey = "";
// Create a proxy to the login service:
var loginClient = new LoginServiceClient("WSHttpBinding_ILoginService");
try
{
// Submit the login request to authenticate the user:
string message;
string authenticationToken;
AuthenticationStatus loginRequest =
loginClient
.Authenticate(
CustomerApiKey,
Password,
UserApiKey,
UserName,
out message,
out authenticationToken);
if (loginRequest == AuthenticationStatus.Ok)
{
// User is authenticated and the authentication token is provided.
Console.WriteLine("User authentication successful.");
}
else
{
// User authentication has failed. Review the message for details.
Console.WriteLine("User authentication failed: " + message);
}
loginClient.Close();
Console.WriteLine("Press a key to exit...");
Console.ReadKey(true);
}
catch (Exception ex)
{
Console.WriteLine("Exception: " + ex);
loginClient.Abort();
throw;
}
}
XML Examples
The Authentication Service (http://
/services/LoginService) is required to get the Token needed for all Core Web Service Calls. The following code is an XML example of authenticating to your UKG Pro data. You can copy the entire contents and update the values in the request. The response example shows how a successful response will be formatted.Login Method Request
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://www.ultipro.com/services/loginservice/ILoginService/Authenticate</a:Action>
<h:ClientAccessKey xmlns:h="http://www.ultipro.com/services/loginservice">CAK</h:ClientAccessKey>
<h:Password xmlns:h="http://www.ultipro.com/services/loginservice">PASSWORD</h:Password>
<h:UserAccessKey xmlns:h="http://www.ultipro.com/services/loginservice">USER API KEY</h:UserAccessKey>
<h:UserName xmlns:h="http://www.ultipro.com/services/loginservice">USERNAME</h:UserName>
</s:Header>
<s:Body>
<TokenRequest xmlns="http://www.ultipro.com/contracts" />
</s:Body>
</s:Envelope>
Login Method Response
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://www.ultipro.com/services/loginservice/ILoginService/AuthenticateResponse</a:Action>
</s:Header>
<s:Body>
<TokenResponse xmlns="http://www.ultipro.com/contracts">
<Status xmlns="http://www.ultipro.com/services/loginservice">Ok</Status>
<StatusMessage i:nil="true" xmlns="http://www.ultipro.com/services/loginservice" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" />
<Token xmlns="http://www.ultipro.com/services/loginservice">LOGIN TOKEN</Token>
</TokenResponse>
</s:Body>
</s:Envelope>
Updated 3 months ago