Skip to main content

Simplifies the process for calling the Workday Web Services API asyncronously.

Project description

WWS API

The Workday Web Services API is a powerful option to extract data from the Workday software. It is a SOAP API that requires requests and responses to be in XML format and are deeply nested structures. This package aims to simplify the process of building scripts that use the API.

There are only a few main functions you'll need to get started:

import wws_api

# pull from API
responses = wws_api.request_wws(url, username, password, xml_template)

# options to process the responses
wws_api.to_dict(responses)
wws_api.to_json(responses)
wws_api.to_pyarrow(responses, start_tag, tags)

Here is a full example of how to extract all companies and options to process the response data.

import wws_api

# create your XML payload template (use WWS documentation).
xml_template = """
    <bsvc:Get_Workday_Companies_Request xmlns:bsvc="urn:com.workday/bsvc" bsvc:version="v44.0">
            <bsvc:Response_Filter>
                <bsvc:Page>{{ page }}</bsvc:Page>
            </bsvc:Response_Filter>
            <bsvc:Response_Group>
                <bsvc:OX_Only>false</bsvc:OX_Only>
            </bsvc:Response_Group>
        </bsvc:Get_Workday_Companies_Request>
    """

# make the request
responses = wws_api.request_wws(url='https://services1.myworkday.com/ccx/service/pacs/Financial_Management/v44.0',
                                username='username',
                                password="password",
                                xml_payload=xml_template)

# options to format the response into a more usable format
research = wws_api.to_dict(responses)  # converts nested xml to dict
wws_api.to_json(responses, file_name='companies', max_num=1)  # saves xml data to JSON file.

# if you want to load to your dataframe of choice (pandas, polars, DuckDB, etc.) load to pyarrow
# and then you can use the built-in methods to convert.
pyarrow_table = wws_api.to_pyarrow(
    responses=responses,
    start_tag='Company',
    tags=["Company_Reference>>ID[@wd:type='Company_Reference_ID']",
          'Company_Data>>Tax_ID_Data>>Tax_ID_Text^^Tax_ID',
          "Company_Data>>Tax_ID_Data>>Tax_ID_Type_Reference>>ID[@wd:type='Tax_ID_Type']",
          'Company_Data>>Organization_Data>>ID^^Organization_Reference_ID',
          'Company_Data>>Organization_Data>>Organization_Name',
          'Company_Data>>Organization_Data>>Organization_Code',
          'Company_Data>>Organization_Data>>Organization_Active',
          "Company_Data>>Organization_Subtype_Reference>>ID[@wd:type='Organization_Subtype_ID']",
          'Company_Data>>Contact_Data>>Address_Data>>@@Formatted_Address^^Full_Address',
          "Company_Data>>Contact_Data>>Address_Data>>Address_Line_Data[@wd:Type='ADDRESS_LINE_1']^^address_line_one",
          "Company_Data>>Contact_Data>>Address_Data>>Address_Line_Data[@wd:Type='ADDRESS_LINE_2']^^address_line_two",
          'Company_Data>>Contact_Data>>Address_Data>>Municipality',
          'Company_Data>>Contact_Data>>Address_Data>>Country_Region_Descriptor',
          'Company_Data>>Contact_Data>>Address_Data>>Postal_Code'
          ]
)

# convert to pandas
df = pyarrow_table.to_pandas()

# convert to polars
import polars as pl
pd_df = pl.from_arrow(pyarrow_table)

# write to parquet
import pyarrow.parquet as pq
pq.write_table(pyarrow_table, 'file_name.parquet')

Other Notes

  • Passwords are automatically html escaped, no need to process before hand.
  • Clean up is done on the xml template to prevent request failures based on whitespace.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wws_api-0.2.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wws_api-0.2.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file wws_api-0.2.0.tar.gz.

File metadata

  • Download URL: wws_api-0.2.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.7

File hashes

Hashes for wws_api-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8ef144b7a06b9cc66025a3010367ada41db7bd2144c1f592f41e77f12de3ba78
MD5 3065828dcddcfca7f751dd4fd6c1d36b
BLAKE2b-256 07ce6b7d648f0076f062fc1e4272a28fb33a15aa9c62f56ba2d4456cb500f32f

See more details on using hashes here.

File details

Details for the file wws_api-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: wws_api-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.7

File hashes

Hashes for wws_api-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf7c878e3976fec86001506c1130939a21ed07c2531ce1c6efd2935f720cd5c9
MD5 eb1d15c1443393e8345a7a57d95d13cc
BLAKE2b-256 d6fec87c8c905c867dbb4fe386ec965b0ec4eafc08fdd867ecfcad2a2816c8dd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page