Jump to content

5g6tdcv4

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by 5g6tdcv4

  1. Not pretty, but you can create a functional warranty lookup from it. #include <HTTP.au3> $url = "https://apigtwb2c.us.dell.com/auth/oauth/v2/token" $postdata = "client_id=" & "YOURID" & "&" & "client_secret=" & "YOURSECRET" & "&" & "grant_type=client_credentials" $test = _HTTP_Post1($url, $postdata) ConsoleWrite($test)   ;this consolewrite will show you your new token if its older than an hour $token ="3997b2f1-1781-426d-bc1f-bd7e0bd9011f"    ;will need to be updated with latest token $ans = _http_get1("https://apigtwb2c.us.dell.com/PROD/sbil/eapi/v5/asset-entitlements?servicetags=YOUR SERIAL") MsgBox(0,"",$ans) Func _HTTP_Post1($url, $postdata = '')     Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")     $oHTTP.Open("POST", $url, False)     If @error Then Return SetError(1, 0, 0)     $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")     $oHTTP.Send($postdata)     If @error Then Return SetError(2, 0, 0)     Local $sReceived = $oHTTP.ResponseText     Local $iStatus = $oHTTP.Status     If $iStatus = 200 Then Return $sReceived     Return SetError(3, $iStatus, $sReceived) EndFunc   ;==>_HTTP_Post Func _HTTP_Get1($url)     Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")     Local $res = $oHTTP.Open("GET", $url, False)     If @error Then Return SetError(1, 0, 0)     #forceref $res     $oHTTP.SetRequestHeader("Content-Type", "application/json")     $oHTTP.SetRequestHeader("Authorization", "Bearer " &$token)     $oHTTP.Send()     If @error Then Return SetError(2, 0, 0)     Local $sReceived = $oHTTP.ResponseText     Local $iStatus = $oHTTP.Status     If $iStatus = 200 Then Return $sReceived     Return SetError(3, $iStatus, $sReceived) EndFunc   ;==>_HTTP_Get
×
×
  • Create New...