Paylocity API 使用 Python 访问
Paylocity API Access using Python
我需要访问我们组织中所有员工的 PTO 数据。
我联系了 Paylocity 支持,但他们无法帮助我。
如果您有类似的任务,能否分享您如何提取此类数据的代码示例?
我能找到的唯一代码:
import urllib
import requests
import json
client_id = 'unique_client_id '
client_secret = 'unique_client_secret '
company_id = 'unique_company_id '
prod_auth_url = 'https://api.paylocity.com/IdentityServer/connect/token'
body_params = urllib.parse.urlencode({'grant_type': 'client_credentials','scope':'WebLinkAPI'})
# Requests can use auth= for basic authentication
auth_response = requests.post(prod_auth_url,auth=(client_id, client_secret), data=body_params)
response = auth_response.json()
print(response)
我得到的输出:
{'access_token': 'my_unique_access_token', 'expires_in': 3600, 'token_type': 'Bearer'}
我的下一步是什么?
以下是 Paylocity Web 服务代表的回答。
我需要访问我们组织中所有员工的 PTO 数据。
我联系了 Paylocity 支持,但他们无法帮助我。
如果您有类似的任务,能否分享您如何提取此类数据的代码示例?
我能找到的唯一代码:
import urllib
import requests
import json
client_id = 'unique_client_id '
client_secret = 'unique_client_secret '
company_id = 'unique_company_id '
prod_auth_url = 'https://api.paylocity.com/IdentityServer/connect/token'
body_params = urllib.parse.urlencode({'grant_type': 'client_credentials','scope':'WebLinkAPI'})
# Requests can use auth= for basic authentication
auth_response = requests.post(prod_auth_url,auth=(client_id, client_secret), data=body_params)
response = auth_response.json()
print(response)
我得到的输出:
{'access_token': 'my_unique_access_token', 'expires_in': 3600, 'token_type': 'Bearer'}
我的下一步是什么?
以下是 Paylocity Web 服务代表的回答。