Could you please help me with this. I am struggling to get data with the Requests library.
import requests
payload = {'company':'USA', 'employeeid':'EMP1235'};
headers= {
"Content-Type": 'application/json',
'Access-Control-Allow-Origin': '*',
'Authorization': "Bearer MyToken Pasted here",
}
response = requests.get(
'https://MyCompanyPath/getEmployeeDetails',
params=payload ,
headers= headers,
)
print(response.json())
# or
print(response.text)
Output
Please note the status is showing 200
with success.
Following is the response content, but I see no data.
{'Parameters': [{'Name': 'company', 'Type': 'String'},
{'Name': 'employeeId', 'Type': 'String'}],
'Return': {'Name': 'return', 'Type': 'String'}}
But in Postman it is showing complete data OUTPUT like following:
"[{\"AccountNumber\":\"\",\"Address\":[{\"Address\":\"123 Coffee Street\\nSuite 300\\nRedmond, WA 98052 \\nUSA\",\"Description\":\"Contoso Entertainment System USA\",\"Primary\":\"No\",\"Purpose\":\"Business\"},{\"Address\":\"8367 Oak Ave\\nBlack Diamond, WA 98122 \\nUSA\",\"Description\":\"Home address\",\"Primary\":\"Yes\",\"Purpose\":\"Home\"}],\"RHRMEmplCategory\":\"\",\"AllowancesInformation\":[],\"AnniversaryDate\":\"/Date(-2208988800000)/\",\"ArabicName\":\"\",\"BankId\":\"\",\"BankLoan\":\"No\",\"BankName\":\"\",\"BirthDate\":\"/Date(-2208988800000)/\",\"ContactInformation\":[{\"ContactDetails\":\"theresa@contoso.com\",\"Description\":\"Work\",\"Extension\":\"\",\"Primary\":\"Yes\",\"Type\":\"Email\"},{\"ContactDetails\":\"425-555-5108\",\"Description\":\"Work\",\"Extension\":\"5108\",\"Primary\":\"Yes\",\"Type\":\"Phone\"}],\"ContractInformation\":[],\"Description\":\"\",\"EmplGender\":\"\",\"EmplMaritalStatus\":\"None\",\"EmployeeJobDetails\":[{\"Description\":\"Treasurer\",\"DescriptionText\":\"\",\"Function\":\"0200\",\"JobName\":\"Treasurer\",\"JobType\":\"Managers\"}],\"EmployeeJobResponsibility\":[{\"areaOfResponsibility\":\"Acctg & Finance\",\"Description\":\"Accounting and finance\",\"note\":\"\"}],\"EmployeeJobTask\":[{\"Description\":\"Financials/Accounting\",\"JobTask\":\"Accounting\",\"note\":\"\"}],\"EmployeeMedicalDetails\":[{\"fromDate\":\"/Date(-2208988800000)/\",\"InsuranceCompanyName\":\"\",\"InsuranceLevel\":\"\",\"InsuranceNumber\":\"\",\"InsuranceType\":\"None\",\"RelativeMedicalDetails\":[],\"toDate\":\"/Date(-2208988800000)/\"}],\"EmployoeeDocumentDetails\":[],\"HcmWorkerName\":\"rrrJayne\",\"IBAN\":\"\",\"NameAlias\":\"Theresa Jayne\",\"Nationality\":\"\",\"NSGEmplLocationId\":\"\",\"PaymentType\":\"\",\"RelativeInformation\":[],\"Religion\":\"\",\"StartDate\":\"/Date(-2208988800000)/\"}]"
Please make a note that JSON is returned as string from 3rd party application.