rlvitorino Posted December 8, 2022 Share Posted December 8, 2022 $strURL = "https://XXXXXXX.XXXXXX.com/XXXXXXXX/rest/authenticate" $sBody = 'username=XXXXXX&password=XXXXXXXXXXX' $WinHttpReq = ObjCreate("Microsoft.XMLHTTP") # Create an HTTP request. $Temp = $WinHttpReq.Open("POST", $strURL, False) # headers $WinHttpReq.SetRequestHeader("Accept","application/text") $WinHttpReq.SetRequestHeader("Content-type", "multipart/form-data") # Send the HTTP request. $WinHttpReq.Send($sBody) # Wait for the response. $WinHttpReq.WaitForResponse(); # Retrieve the response text. $strResult = $WinHttpReq.ResponseText ConsoleWrite($WinHttpReq.ResponseBody) MsgBox("","Resultado",$strResult) MsgBox("","Resultado",$WinHttpReq.Status) MsgBox("","Resultado",$WinHttpReq.StatusText) I'm trying to execute an API call, but the return is always empty, I've tested other calls and the values are coming normally, does anyone know what it could be? Return is 200 but ResponseText or ResponseBody is empty. Trying with Objects :"WinHttp.WinHttpRequest.5.1" AND "Microsoft.XMLHTTP" Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 9, 2022 Moderators Share Posted December 9, 2022 Moved to the appropriate forum. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Danp2 Posted December 9, 2022 Share Posted December 9, 2022 It would be helpful if you could share more details, such as a link to the API documentation. Help us to be able to help you. 😉 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
rlvitorino Posted December 12, 2022 Author Share Posted December 12, 2022 Basically I'm trying to make this call via autoit, for postman it would be something like this: So it would return a token in the json to be able to use it, but it is returning blank. Has anyone had this problem ? Link to comment Share on other sites More sharing options...
Danp2 Posted December 12, 2022 Share Posted December 12, 2022 Please try it like this -- $strURL = "https://ondemand.automationedge.com/aeengine/rest/authenticate" $sBody = 'username=XXXXXX&password=XXXXXXXXXXX' $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") # Create an HTTP request. $Temp = $oHTTP.Open("POST", $strURL, False) # headers $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.SetRequestHeader("Accept", "application/json") # Send the HTTP request. $oHTTP.Send($sBody) # Wait for the response. $oHTTP.WaitForResponse(); # Retrieve the response text. $strResult = $oHTTP.ResponseText ConsoleWrite($oHTTP.ResponseBody) MsgBox("","Resultado",$strResult) MsgBox("","Resultado",$oHTTP.Status) MsgBox("","Resultado",$oHTTP.StatusText) Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now