Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #11569

Re: vbscript post to REST API HELP

Newsgroups microsoft.public.scripting.vbscript
Subject Re: vbscript post to REST API HELP
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References <ee2f9787-86db-422c-b0ee-7b4b47b8c070@googlegroups.com>
Date 2017-02-22 23:06 +0100
Message-ID <XnsA724EB08D5443eejj99@194.109.6.166> (permalink)

Show all headers | View raw


scotrn@gmail.com wrote on 22 Feb 2017 in
microsoft.public.scripting.vbscript: 

> Hi, 
> 
> New to vbscript and trying to troubleshoot an "Unspecified error"  
> 
>  I have been trying to glue this together from search results. It seems
>  to try and run but getting the generic 80004005 error code which isn't
>  helping.   Small script hope someone can spot the problem. 
> 
> Option Explicit
> Dim objXmlHttpMain, user , password , URL, strJSONToSend 
> 
> user = "testuser"
> password = "testpass"
> URL="https://testsitname.com/api/alert" 
> 
> strJSONToSend = "{aligned_resource"": ""/device/17653"", ""message"":
> ""TESTING API""}" 
> 
> 
> Set objXmlHttpMain = CreateObject("Msxml2.ServerXMLHTTP") 
> On Error Resume Next 
> objXmlHttpMain.setRequestHeader "Content-Type", "application/json"
> objXmlHttpMain.send strJSONToSend
> objXmlHttpMain.open "POST",URL, False, user, password 

You should first .open something and only then .send it.


> If Err Then            'handle errors
>   WScript.Echo Err.Description & " [0x" & Hex(Err.Number) & "]"
>   WScript.Quit 1
> End If
> On Error Goto 0        'disable error handling again
> 
> 
> 
> 
>  
> 



-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Back to microsoft.public.scripting.vbscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

vbscript post to REST API   HELP scotrn@gmail.com - 2017-02-22 12:17 -0800
  Re: vbscript post to REST API   HELP "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-22 23:06 +0100
    Re: vbscript post to REST API   HELP Scot Needy <scotrn@gmail.com> - 2017-02-22 17:14 -0800
      Re: vbscript post to REST API   HELP Scot Needy <scotrn@gmail.com> - 2017-02-22 21:22 -0800
        Re: vbscript post to REST API   HELP JJ <jj4public@vfemail.net> - 2017-02-24 08:20 +0700
          Re: vbscript post to REST API   HELP Scot Needy <scotrn@gmail.com> - 2017-02-23 20:03 -0800
      Re: vbscript post to REST API   HELP "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-23 10:50 +0100
        Re: vbscript post to REST API   HELP Scot Needy <scotrn@gmail.com> - 2017-02-23 04:54 -0800
          Re: vbscript post to REST API   HELP "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-23 14:06 +0100
            Re: vbscript post to REST API   HELP Scot Needy <scotrn@gmail.com> - 2017-02-23 09:10 -0800
              Re: vbscript post to REST API   HELP "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-23 20:02 +0100
              Re: vbscript post to REST API   HELP "Mayayana" <mayayana@invalid.nospam> - 2017-02-23 17:19 -0500
                Re: vbscript post to REST API   HELP Scot Needy <scotrn@gmail.com> - 2017-02-23 19:32 -0800
                Re: vbscript post to REST API   HELP "Mayayana" <mayayana@invalid.nospam> - 2017-02-23 23:07 -0500
                Re: vbscript post to REST API   HELP "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-24 09:17 +0100
                Re: vbscript post to REST API   HELP "Mayayana" <mayayana@invalid.nospam> - 2017-02-24 10:22 -0500
  Re: vbscript post to REST API   HELP davidjsmith10@gmail.com - 2020-01-13 09:15 -0800

csiph-web