通过Python实现对SuccessFactors API的调用
import requests
pr1 = {'company_id': 'xxXX', 'client_id': 'XXXX', 'token_url': 'https://api15.sapsf.cn/oauth/token', 'user_id': 'SFADMIN', 'private_key': 'XXXX'}
hd1 = {'Content-Type':"application/x-www-form-urlencoded"}
response = requests.post("https://api15.sapsf.cn/oauth/idp",params=pr1, headers=hd1)
as1 = response.content
# get assertion
# get token
pr2 = {'company_id': 'XXXX', 'client_id': 'XXXX', 'grant_type': 'urn:ietf:params:oauth:grant-type:saml2-bearer', 'user_id': 'SFADMIN', 'assertion': as1}
hd2= {'Content-Type':"application/x-www-form-urlencoded"}
response = requests.post("https://api15.sapsf.cn/oauth/token",params=pr2, headers=hd2)
# get token
# get api