How to Get Employees from the Workday API with Python (2024)

How to Get Employees from the Workday API with Python (1)

Aaron Lu

·

Follow

Published in

Merge

·

5 min read

·

Mar 8, 2022

--

If you’re building a direct integration with Workday, one of the most basic things you’ll want to do is pull employees from the Workday API. The following article covers how you can start interacting with Workday’s SOAP API.

As a note from the authors (who’ve built an entire Workday integration), we truly believe the quickest way to get a Workday integration is via a unified API provider, such as Merge.

In this article, we’ll cover how to understand Workday’s SOAP API, how to set proper permissions in Workday, and how to write a GET request to Workday’s SOAP API in Python.Understanding Workday’s SOAP API!

While most modern applications structure their APIs with a REST architecture, Workday employs an architecture known as SOAP. SOAP stands for Simple Object Access Protocol, and returns information with the following format:

<xsd:simpleType name="Assignable_RoleReferenceEnumeration">
<xsd:restriction base="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<wd:enumeration value="WID"/>
<wd:enumeration value="Organization_Role_ID"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:restriction>
</xsd:simpleType>

Getting Permissions for Workday HRIS and ATS

In order to begin receiving SOAP responses from Workday, you need to create an Integrated System User (ISU) with the proper permissions. Workday configures their permissions on a field level, so you’ll need to grant yourself access to a number of fields to get things up and running.

Please note that the following steps will need to be accomplished by a Workday user with administrative access.

  1. Access the Create Integration System User task through Workday’s search bar and create a new user
  2. Add the new user to the list of System Users in order to guarantee the password you created does not expire
  3. Access the Create Security Group task and create a new User-Based Security Group
  4. Add the Integration System User you’ve created to the group and save your progress

After step four, you’ll need to follow different processes depending on which Workday API endpoints you wish to pull data from.

  1. Search Workday for Public Web Services
  2. Open the report
  3. Hover over Human Resources and click the three dots to access the menu
  4. Click Web Service, then View WSDL
  5. Navigate to the bottom of the WSDL page to find the hostname
  6. Look for the Username, Password, Tenant Name (https://wd5-services1.workday.com/TENANT_NAME), and Endpoint URL. Save these somewhere secure for later
  1. Navigate to the Domain Security Policy tab under Web Service
  2. Search for Recruiting Web Services
  3. Add permissions to the User’s Security Group for the endpoints you’ll be accessing (for example Get_Applicants, Get_Job_Postings, etc.)
  4. Look for the Username, Password, Tenant Name (https://wd5-services1.workday.com/TENANT_NAME), and Endpoint URL under the User’s Security Group. Save these somewhere secure for later.

Set Up Your Request File

Open up a new Python file, and call it workday_requester.py

Import json, requests, and xmltodict from parse.

As we mentioned above, the Workday API returns responses in XML. You, like most developers, are probably used to a dictionary. xmltodict lets us parse the response by returning an ordered dictionary that we can then turn into a dictionary.

import requests
from xmltodict import parse

Create and store the tenant_name, your username, password, and url from Step 4 as variables.

tenant_name = "tenant"
username = f"ISU_USERNAME@{tenant_name}"
password = "PASSWORD"
# Exact URL may vary
url = f"https://services1.myworkday.com/ccx/service/{tenant_name}/Human_Resources/v36.2"

Below is an example of the request body you would use to fetch employees using the Get Workers Endpoint. You’ll need to tweak this request body to fit the API endpoint you’d like to call.

Note that to deal with pagination, you need to set a page number for the request as well. Save this as a variable.

page_number = 1

SOAP requests contain 2–4 blocks. You can think of a block as similar structure HTML, which requires both an opening and closing tag. The SOAP blocks are Envelope, Header, Body, and Fault. The syntax for these are <soapenv:{blockname}> </soapenv:{blockname}>. For a basic SOAP request, only the Envelope and Body are required.

To get employees, we’ll need to use the Envelope, Header, and Body blocks.

To help you think about the structure of SOAP, you can think of a SOAP Request as a ‘package/’ The Envelope is being the ‘packaging,’ the Header is the ‘Sent from Address’, and the Body is the ‘letter/contents’ of the package.

We’ll first create the Envelope with a namespace attribute xmlns:soapenv=”https://schemas.xmlsoap.org/soap/envelope/” .

Our opening Envelope block will look something like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bsvc="urn:com.workday/bsvc">

The other two blocks (the Header and Body) will be wrapped inside this Envelope.

The Header will contain our API access credentials and the security needed to access it. Alone, the header will look like this:

<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>{username}</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">{password}</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>

The bulk of our actual request will be in the Body. There, we will define the parameters and data we’d like to fetch.

For our example, we’re making a Get_Workers_Request, and because we’re also using pagination we’ll want to pass page_number as a parameter.

To call a different endpoint, change the bsvc payload in the SOAP body to the endpoint of your choosing.

<bsvc:Get_Workers_Request>
</bsvc:Get_Workers_Request>

Note how we’re leaving out soapenv:Fault, which would generally be used to catch error codes when your SOAP API call is incomplete.

Look at the example below to see how the Envelope, Header, and Body all fit together in a SOAP request.

request_body = f"""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bsvc="urn:com.workday/bsvc">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>{username}</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">{password}</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<bsvc:Get_Workers_Request>
<bsvc:Response_Filter>
<bsvc:Page>{page_number}</bsvc:Page>
</bsvc:Response_Filter>
</bsvc:Get_Workers_Request>
</soapenv:Body>
</soapenv:Envelope>"""
response = requests.request(method="POST", url=url, data=request_body)

We’ll then want to make the call by calling requests with the URL and request body. In a traditional REST API call we would use method=”GET”, but with SOAP we’ll be calling “POST” to the Get_Workers_Request endpoint to access this data.

In order to make the resulting response more readable, we can use json.loads and the parse method to convert the response to a dictionary.

parsed_response = json.loads(parse(response.content))

The resulting response will look similar to this:

{
'env:Envelope': {
'@xmlns:env': 'http://schemas.xmlsoap.org/soap/envelope/',
'env:Body': {
'wd:Get_Workers_Response': {
'@xmlns:wd': 'urn:com.workday/bsvc',
'@wd:version': 'v37.0',
'wd:Response_Filter': {
'wd:Page': '1',
'wd:Count': '100'
},
'wd:Response_Results': {
'wd:Total_Results': '100',
'wd:Total_Pages': '1',
'wd:Page_Results': '1000',
'wd:Page': '1'
},
'wd:Response_Data': {
'wd:Worker': {
'wd:Worker_Reference': {
'wd:ID': [{
'@wd:type': 'WID',
'#text': '2000000000'
},
{
'@wd:type': 'Employee_ID',
'#text': '100001'
}
]
},
'wd:Worker_Descriptor': 'Daniel Rothman',
'wd:Worker_Data': {
'wd:Worker_ID': '100001',
'wd:User_ID': 'Daniel.Rothman'
}
}
}
}
}
}
}

We’ve shortened the response here, but the response will likely include fields like the employees contact information, hire date, weekly hours and more!

And that’s it! You’ve successfully pulled the employees object from the Workday API.

At Merge, we’ve built an API that lets you easily pull from Workday using REST (no SOAP required). Our Unified API has also smoothed out pagination and authentication.

We offer over 60+ integrations, including Workday, BambooHR, and UKG.

If you already have Workday credentials, you can sign-up for a Merge account here, learn how to add a test linked account here, and begin testing Merge endpoints here.

How to Get Employees from the Workday API with Python (2024)

FAQs

Can you use Python in Workday? ›

The rich ecosystem of Python modules lets you get to work quickly and integrate your systems more effectively. With the CData Python Connector for Workday and the petl framework, you can build Workday-connected applications and pipelines for extracting, transforming, and loading Workday data.

Does Workday have a public API? ›

Workday API facilitates the integration process by helping enterprises to integrate workday system with external systems and applications utilized by the business environments. Workday API's uses web services such as WSDL, SOAP, REST for the seamless integration process.

How to pull data from Workday? ›

To extract data via the Workday Reporting as a Service API, use the Workday Custom Reports component instead. Using this component may return structured data that requires flattening. For help with flattening such data, we recommend using the Extract Nested Data component for Snowflake.

How to get Workday API access? ›

Accessing the Workday ATS API
  1. Navigate to the Domain Security Policy tab under Web Service.
  2. Search for Recruiting Web Services.
  3. Add permissions to the User's Security Group for the endpoints you'll be accessing (for example Get_Applicants, Get_Job_Postings, etc.)

What coding language does Workday use? ›

The Workday Studio requires multiple programming languages. It is not just restricted to a single language. It makes use of languages like Python, Java, Ruby. Based on the efficiency and the programming language, you can select any one of them and start building integration on the platform.

Is Python sufficient for job? ›

Python alone isn't going to get you a job unless you are extremely good at it. Not that you shouldn't learn it: it's a great skill to have since python can pretty much do anything and coding it is fast and easy. It's also a great first programming language according to lots of programmers.

How do I pull an employee report in Workday? ›

How to Run a Report in Workday?
  1. Step 1: Access the Workday System. To easily access the Workday system, simply follow these steps: ...
  2. Step 2: Navigate to the Reports Tab. ...
  3. Step 3: Choose the Type of Report. ...
  4. Step 4: Select the Criteria for the Report. ...
  5. Step 5: Run the Report.

How do I export candidates from Workday? ›

Connecting to Workday

On the Capabilities tab, check the box next to Export. Check Export only as Prospects if you choose not to export candidates to job pools in your ATS. Check Include Social Networks to export a candidate's social network links to your ATS.

How do I look up employees in Workday? ›

For example, to find a worker, enter their name into the Search box, and then Enter on your keyboard. From the search results, navigate to the Categories list and select People to filter the results to only display workers in your organization.

What is the base URL of Workday rest API? ›

To find the base URL (domain) and tenant of your Workday environment, search for View API Clients. You will be able to derive the base URL from the Workday REST API Endpoint field. The format is https://{domain}.workday.com/ccx/api/v1/{tenant} .

What is the rate limit for API in Workday? ›

Obtain an API Key from the Workday Developer Portal and generate an access token using the OAuth 2.0 flow. What are the rate limits for API requests? The standard rate limit is 10 requests per second per tenant. You can request a higher rate limit through the Workday Support Portal.

How do I access a company's API? ›

To locate the API of a company you can follow these steps:
  1. Go to their official website and check if they have a developer's section.
  2. Look for a link to an API documentation or API reference.
  3. If they don't have a section specifically for developers, try searching their website for 'API'

What systems integrate with Workday? ›

5 Best Workday Integrations for 2024
Best Workday HCM integrationUKG
Best Workday Learning and Development integrationeduMe
Best Workday Payroll integrationADP
Best Workday Timekeeping software integrationClockify
Best Workday OKR software integrationCulture AMP

Can you use SQL in Workday? ›

CData Connect Cloud provides a pure SQL Server interface for Workday, allowing you to query data from Workday without replicating the data to a natively supported database. Using optimized data processing out of the box, CData Connect Cloud pushes all supported SQL operations (filters, JOINs, etc.)

Can I use Python to automate tasks? ›

Python shines in the world of task scheduling and workflow management. Using libraries like "sched" and tools such as Celery, Python can automate tasks and manage complex workflows. This automation profoundly impacts process execution by reducing human error, enhancing process efficiency, and boosting productivity.

Top Articles
Latest Posts
Article information

Author: Ms. Lucile Johns

Last Updated:

Views: 5267

Rating: 4 / 5 (61 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Ms. Lucile Johns

Birthday: 1999-11-16

Address: Suite 237 56046 Walsh Coves, West Enid, VT 46557

Phone: +59115435987187

Job: Education Supervisor

Hobby: Genealogy, Stone skipping, Skydiving, Nordic skating, Couponing, Coloring, Gardening

Introduction: My name is Ms. Lucile Johns, I am a successful, friendly, friendly, homely, adventurous, handsome, delightful person who loves writing and wants to share my knowledge and understanding with you.