• WinHTTP problems

    From Rob@21:1/5 to All on Tue Jan 22 13:28:43 2019
    Hi,

    I have a *large* legacy program written in VB6, Very successfull,
    works fine on all flavours of Windows up to and including 10

    Now I need to communicate with a third party using TML Basic Auth and
    JSON.

    SO far I have created some short code to test the communications:

    Dim HttpReq As New WinHttp.WinHttpRequest

    HttpReq.SetCredentials "<username>", "<password>", 0


    HttpReq.Open "PUT", "https://<API URL>", False


    HttpReq.setRequestHeader "Content-Type", "application/json"

    HttpReq.Send " "

    HttpReq.Send "GET https://<API URL>"

    Both the Send methods result in:
    {
    "status": "error",
    "code": 401,
    "message": "Access denied"
    }


    The sane credentials do work OK in Postman app.

    What am I missing or doing wrong please?

    --
    RobP

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wolfgang =?utf-8?Q?=CE=95nzinger?=@21:1/5 to All on Sun Feb 17 13:09:54 2019
    Multiposted - answered in comp.lang.basic.misc.


    Am Tue, 22 Jan 2019 13:28:43 -0000 schrieb Rob:

    Hi,

    I have a *large* legacy program written in VB6, Very successfull,
    works fine on all flavours of Windows up to and including 10

    Now I need to communicate with a third party using TML Basic Auth and
    JSON.

    SO far I have created some short code to test the communications:

    Dim HttpReq As New WinHttp.WinHttpRequest

    HttpReq.SetCredentials "<username>", "<password>", 0


    HttpReq.Open "PUT", "https://<API URL>", False


    HttpReq.setRequestHeader "Content-Type", "application/json"

    HttpReq.Send " "

    HttpReq.Send "GET https://<API URL>"

    Both the Send methods result in:
    {
    "status": "error",
    "code": 401,
    "message": "Access denied"
    }


    The sane credentials do work OK in Postman app.

    What am I missing or doing wrong please?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)