Calling a Dell one web service,
Using POSTMAN, first i used POST to get the session ID, second GET to get the output response.
In POSTMAN,
1) POST:
import requests
url = "">192.168.**.*/.../apphost"
payload = "{\"authString\":\"Module=DialogUser;User=admin;Password=Abcd1234\"}"
headers = {
'content-type': "application/json",
'cache-control': "no-cache",
'postman-token': "469a3d55-83f3-b1ee-a4**-1d1084d47***"
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
OUTPUT:
{
"sessionId": "0b**88zeO8h81TZ2z***",
"displayName": "",
"responseStatus": {}
}
2) GET:
import requests url = "">192.168.**.*:80/.../TableName" querystring = {"loadType":"Default"} payload = "{\"authString\":\"Module=DialogUser;User=admin;Password=Abcd1234\"}" headers = { 'content-type': "application/json", 'cache-control': "no-cache", 'postman-token': "fccfab**-02**-17**-ffeb-725f3b244***" } response = requests.request("GET", url, data=payload, headers=headers, params=querystring) print(response.text)
OUTPUT:
[{"uri":"http://192.168.**.*/IMAppServer/api/entity/TableName/c6df1***-b51b-4f70-bd87-c64f60b4****","display":"SENSOR","longDisplay":"SENSOR","values":{"DisplayName":"SENSOR","UID_TableName":"c6df1***-b51b-4f70-bd87-c64f60b44***","Deletion":0},"displayValues":{"Deletion":""}}]
So I am able to retrieve values using POSTMAN.
But the same thing when i do it in Python3 The first POST request is giving me the output(i.e Session_id
),
but the second query is not giving me anything. Only status code: 401
Any help?