Click here to Skip to main content
15,943,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to pass a params named ID in to a python api function from postman which will use the ID to call another api function inside the actual api

but the id field remains None in postman output

requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.xxx.com/api/v1/target/id/None/id?isidRequired=True


What I have tried:

this is my code

Python
@D.route('/Checkcontactinfo/', methods=['GET'])
def checkcontact():
    id = request.args.get('id')
    ivurl: str = f'{xxx}/id/{id}/id?'
    payload: Dict[str, Union[bool, int]] = {'isIDRequired': True,
    'id':id}
    response = get_iv_response(url=ivurl, payload=payload)
    ID_contact_totalresult: int = response.get('totalResults')
    return id_contact_totalresult
Posted
Updated 5-Oct-20 21:53pm
v2
Comments
Sandeep Mewara 6-Oct-20 1:40am    
The 401 Unauthorized Error is an HTTP response status code indicating that the request sent by the client could not be authenticated.
Member 13998042 6-Oct-20 2:04am    
yes you are correct the reason i need to pass the id in the none field , the id is something that i am giving from postman as params ,but the issue is the id field in ivurl keeps on becoming null
Richard MacCutchan 6-Oct-20 7:19am    
It is impossible for anyone here to guess why that item is null. Where is it supposed to come from, and where is the code you are using to find it?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900