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


Groups > microsoft.public.scripting.vbscript > #11568 > unrolled thread

vbscript post to REST API HELP

Started byscotrn@gmail.com
First post2017-02-22 12:17 -0800
Last post2020-01-13 09:15 -0800
Articles 17 — 6 participants

Back to article view | Back to microsoft.public.scripting.vbscript


Contents

  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

#11568 — vbscript post to REST API HELP

Fromscotrn@gmail.com
Date2017-02-22 12:17 -0800
Subjectvbscript post to REST API HELP
Message-ID<ee2f9787-86db-422c-b0ee-7b4b47b8c070@googlegroups.com>
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 

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




 

[toc] | [next] | [standalone]


#11569

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2017-02-22 23:06 +0100
Message-ID<XnsA724EB08D5443eejj99@194.109.6.166>
In reply to#11568
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)

[toc] | [prev] | [next] | [standalone]


#11570

FromScot Needy <scotrn@gmail.com>
Date2017-02-22 17:14 -0800
Message-ID<3be13017-79f8-442f-9f0b-96af64b2328f@googlegroups.com>
In reply to#11569
Thanks Evertjan I caught that after I posted. So many changes just to try and get this working. 

Still getting 80004005 "unspecified error" I suspect it has something to do with the Msxml2.ServerXMLHTTP methods i'm using but I'm having trouble finding good examples. 


Option Explicit
Dim objXmlHttpMain, user , password , URL, strJSONToSend, TaskName

user = "testuser"
password = "testpass"
URL="https://testsitename.com/api/alert" 
TaskName = "TestJob"


strJSONToSend = "{aligned_resource"": ""/device/17653"", ""message"": ""Taskname Failed""}"

Set objXmlHttpMain = CreateObject("Msxml2.ServerXMLHTTP") 
On Error Resume Next 
objXmlHttpMain.open "POST",URL, False 
objXmlHttpMain.setRequestHeader "Content-Type", "application/json"
objXmlHttpMain.send("username=user&password=password")
objXmlHttpMain.send(strJSONToSend)

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

[toc] | [prev] | [next] | [standalone]


#11571

FromScot Needy <scotrn@gmail.com>
Date2017-02-22 21:22 -0800
Message-ID<1ae350da-815f-48ab-a5ac-0b17c83de172@googlegroups.com>
In reply to#11570
So I changed to http and ran some tcpdumps on the webserver side. 

The POST is getting sent but for some reason the vbscript is getting a 404. 
I took the username:password and Base64 encoded them for the Auth Header. 
From a packetdump the Authorization looks identical!! I don't see why this would fail. 

strJSONToSend = "{""aligned_resource"": ""/device/12518"", ""message"": ""Task Failed""}"
url = "http://testsitename.com/api/alert"
Set xmlhttp = CreateObject("MSXML2.serverXMLHTTP")
on error resume next
xmlhttp.open "POST", url, false, username, password
xmlhttp.setRequestHeader "Authorization", "Basic b3Nhc********DFvbGllbTc=" 
xmlhttp.setRequestHeader "Content-Type", "application/json"
xmlhttp.send(strJSONToSend)



I compared this against a packet capture of a successful curl command 
curl -i -k -H "Content-Type:application/json" -u "${username}:${password}" -X POST $address -d '{"aligned_resource":"/device/12518","message":"TESTING"}'

[toc] | [prev] | [next] | [standalone]


#11578

FromJJ <jj4public@vfemail.net>
Date2017-02-24 08:20 +0700
Message-ID<ugs2rxcjl132$.1lt4szfpq1s4x.dlg@40tude.net>
In reply to#11571
On Wed, 22 Feb 2017 21:22:34 -0800 (PST), Scot Needy wrote:
> So I changed to http and ran some tcpdumps on the webserver side. 
> 
> The POST is getting sent but for some reason the vbscript is getting a 404. 

You should provide an actual working URL, because the URL that you've
provided points to a non existant resource in the server.

  http://testsitename.com/api/alert

Will always result to HTTP code 404. Whether a credential is given or not.

[toc] | [prev] | [next] | [standalone]


#11580

FromScot Needy <scotrn@gmail.com>
Date2017-02-23 20:03 -0800
Message-ID<9cef2324-37a3-496b-b694-710d2adcf279@googlegroups.com>
In reply to#11578
On Thursday, February 23, 2017 at 8:20:20 PM UTC-5, JJ wrote:
> On Wed, 22 Feb 2017 21:22:34 -0800 (PST), Scot Needy wrote:
> > So I changed to http and ran some tcpdumps on the webserver side. 
> > 
> > The POST is getting sent but for some reason the vbscript is getting a 404. 
> 
> You should provide an actual working URL, because the URL that you've
> provided points to a non existant resource in the server.
> 
>   http://testsitename.com/api/alert
> 
> Will always result to HTTP code 404. Whether a credential is given or not.

Yea JJ but I needed to modify the real values to be somewhat anonymous besides the actual URL is on private ip space and DNS. Would not have helped in a public forum. 

Glad to say I have my simple post working after gutting it of any fluff.  Now I need to add it back in but really wasn't sure it was working right in the first place which is why I posted an open question about logical error checking. 

To me, the first two places something like this would fail on is authorization or error from open or send methods. Also I still don't understand if/how this works. Seems like there should be more.  
   Set objXmlHttpMain = CreateObject("Msxml2.XMLHTTP") 
   on error resume next 

Seems like vbs using Msxml2 is pretty rare from google searches so I'm just trying to piece it together from search results. 

Going to start looking at these examples to start.  I'm sure I'll get stuck along the lines. 
https://coderwall.com/p/ljvj-g/unlikely-coding-a-vbscript-posting-to-a-rest-api
http://stackoverflow.com/questions/26956256/how-to-post-json-data-via-http-api-using-vbscript
http://stackoverflow.com/questions/24863986/vbscript-msxml12-xmlhttp-error-handling



This site had a pretty good breakdown of XmlHttp 
http://www.c-amie.co.uk/technical/javascript-serverxmlhttp-emulation/ 

[toc] | [prev] | [next] | [standalone]


#11572

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2017-02-23 10:50 +0100
Message-ID<XnsA7256E3E58F40eejj99@194.109.6.166>
In reply to#11570
Scot Needy <scotrn@gmail.com> wrote on 23 Feb 2017 in
microsoft.public.scripting.vbscript: 

> Thanks Evertjan I caught that after I posted. So many changes just to
> try and get this working. 
> 
> Still getting 80004005 "unspecified error" I suspect it has something to
> do with the Msxml2.ServerXMLHTTP methods i'm using but I'm having
> trouble finding good examples. 
[..] 
> strJSONToSend = "{aligned_resource"": ""/device/17653"", ""message"":
> ""Taskname Failed""}" 

strJSONToSend = "{""aligned_resource"":.....

But probably, that is not what thows the error.

Please start by debugging, programming in breakpoints, etc.

We should not do this testing for you.

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

[toc] | [prev] | [next] | [standalone]


#11573

FromScot Needy <scotrn@gmail.com>
Date2017-02-23 04:54 -0800
Message-ID<308d9bc2-eeea-4ba3-aec0-0c74340c8221@googlegroups.com>
In reply to#11572
On Thursday, February 23, 2017 at 4:50:17 AM UTC-5, Evertjan. wrote:
> Scot Needy <scotrn@gmail.com> wrote on 23 Feb 2017 in
> microsoft.public.scripting.vbscript: 
> 
> > Thanks Evertjan I caught that after I posted. So many changes just to
> > try and get this working. 
> > 
> > Still getting 80004005 "unspecified error" I suspect it has something to
> > do with the Msxml2.ServerXMLHTTP methods i'm using but I'm having
> > trouble finding good examples. 
> [..] 
> > strJSONToSend = "{aligned_resource"": ""/device/17653"", ""message"":
> > ""Taskname Failed""}" 
> 
> strJSONToSend = "{""aligned_resource"":.....
> 
> But probably, that is not what thows the error.
> 
> Please start by debugging, programming in breakpoints, etc.
> 
> We should not do this testing for you.
> 
> -- 
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

Evertjan, 

Your correction is not what I posted and does not address the error as you stated. 
Your assuming I'm just throwing this out there without debugging ?  I'm reaching out because I have spent the last 20+ hours trying to get a simple curl one line into vbs.  

My problem was the base64 encoded string I created it had encoded the ":" and gave me 2 incorrect characters in the string.  I changed it to what I captured and the code now works but needs error checking.  
I tried getting and example I saw to dynamically encode but failed completely. 
Removed credentials from the open statement and using the encoded string only. 
xmlhttp.open "POST", url, false 
xmlhttp.setRequestHeader "Authorization", "Basic ******encoded string****" 
xmlhttp.setRequestHeader "Content-Type", "application/json"
xmlhttp.send(strJSONToSend)


Anyone have good working example of error condition checks ?  I've tried all the ones I found on Google.   

[toc] | [prev] | [next] | [standalone]


#11574

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2017-02-23 14:06 +0100
Message-ID<XnsA7258F7D575D6eejj99@194.109.6.166>
In reply to#11573
Scot Needy <scotrn@gmail.com> wrote on 23 Feb 2017 in
microsoft.public.scripting.vbscript: 

> On Thursday, February 23, 2017 at 4:50:17 AM UTC-5, Evertjan. wrote:
>> Scot Needy <scotrn@gmail.com> wrote on 23 Feb 2017 in
>> microsoft.public.scripting.vbscript: 
>> 
>> > Thanks Evertjan I caught that after I posted. So many changes just to
>> > try and get this working. 
>> > 
>> > Still getting 80004005 "unspecified error" I suspect it has something
>> > to do with the Msxml2.ServerXMLHTTP methods i'm using but I'm having
>> > trouble finding good examples. 
>> [..] 
>> > strJSONToSend = "{aligned_resource"": ""/device/17653"", ""message"":
>> > ""Taskname Failed""}" 
>> 
>> strJSONToSend = "{""aligned_resource"":.....
>> 
>> But probably, that is not what thows the error.
>> 
>> Please start by debugging, programming in breakpoints, etc.
>> 
>> We should not do this testing for you.

[please do not quote signatures on usenet, signature removed]
 
> Your correction is not what I posted and does not address the error as
> you stated.

> Your assuming I'm just throwing this out there without
> debugging ? 

Well, what else could I assume 
if you do not give the fact and the the results of your debugging. 

> I'm reaching out because I have spent the last 20+ hours
> trying to get a simple curl one line into vbs.
> 
> My problem was the base64 encoded string I created it had encoded the
> ":" and gave me 2 incorrect characters in the string. 

That is rather a different story, isn't it?

Did you give the code for that creation?

> I changed it to
> what I captured and the code now works but needs error checking.  I
> tried getting and example I saw to dynamically encode but failed
> completely.

Why would it need error-checking if it works?

Please specify what error[s] you expect to catch.

> Removed credentials from the open statement and using the
> encoded string only.
> xmlhttp.open "POST", url, false 
> xmlhttp.setRequestHeader "Authorization", "Basic ******encoded
> string****" 
> xmlhttp.setRequestHeader "Content-Type", "application/json"

> xmlhttp.send(strJSONToSend)
> 
> Anyone have good working example of error condition checks ?  I've tried
> all the ones I found on Google.   

See above. 

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

[toc] | [prev] | [next] | [standalone]


#11575

FromScot Needy <scotrn@gmail.com>
Date2017-02-23 09:10 -0800
Message-ID<0ba28ba5-7a01-4de5-b3ff-c193007a95d2@googlegroups.com>
In reply to#11574
On Thursday, February 23, 2017 at 8:06:53 AM UTC-5, Evertjan. wrote:
> Scot Needy <scotrn@gmail.com> wrote on 23 Feb 2017 in
> microsoft.public.scripting.vbscript: 
> 
> > On Thursday, February 23, 2017 at 4:50:17 AM UTC-5, Evertjan. wrote:
> >> Scot Needy <scotrn@gmail.com> wrote on 23 Feb 2017 in
> >> microsoft.public.scripting.vbscript: 
> >> 
> >> > Thanks Evertjan I caught that after I posted. So many changes just to
> >> > try and get this working. 
> >> > 
> >> > Still getting 80004005 "unspecified error" I suspect it has something
> >> > to do with the Msxml2.ServerXMLHTTP methods i'm using but I'm having
> >> > trouble finding good examples. 
> >> [..] 
> >> > strJSONToSend = "{aligned_resource"": ""/device/17653"", ""message"":
> >> > ""Taskname Failed""}" 
> >> 
> >> strJSONToSend = "{""aligned_resource"":.....
> >> 
> >> But probably, that is not what thows the error.
> >> 
> >> Please start by debugging, programming in breakpoints, etc.
> >> 
> >> We should not do this testing for you.
> 
> [please do not quote signatures on usenet, signature removed]
>  
> > Your correction is not what I posted and does not address the error as
> > you stated.
> 
> > Your assuming I'm just throwing this out there without
> > debugging ? 
> 
> Well, what else could I assume 
> if you do not give the fact and the the results of your debugging. 
> 
> > I'm reaching out because I have spent the last 20+ hours
> > trying to get a simple curl one line into vbs.
> > 
> > My problem was the base64 encoded string I created it had encoded the
> > ":" and gave me 2 incorrect characters in the string. 
> 
> That is rather a different story, isn't it?
> 
> Did you give the code for that creation?
> 
> > I changed it to
> > what I captured and the code now works but needs error checking.  I
> > tried getting and example I saw to dynamically encode but failed
> > completely.
> 
> Why would it need error-checking if it works?
> 
> Please specify what error[s] you expect to catch.
> 
> > Removed credentials from the open statement and using the
> > encoded string only.
> > xmlhttp.open "POST", url, false 
> > xmlhttp.setRequestHeader "Authorization", "Basic ******encoded
> > string****" 
> > xmlhttp.setRequestHeader "Content-Type", "application/json"
> 
> > xmlhttp.send(strJSONToSend)
> > 
> > Anyone have good working example of error condition checks ?  I've tried
> > all the ones I found on Google.   
> 
> See above. 
> 
> -- 
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

Evertjan I really don't  need your condescending attitude. Pack your ego away if your here to help.  

"Why would it need error-checking if it works? "  REALLY ?    

[toc] | [prev] | [next] | [standalone]


#11576

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2017-02-23 20:02 +0100
Message-ID<XnsA725CBDA6306Ceejj99@194.109.6.166>
In reply to#11575
Scot Needy <scotrn@gmail.com> wrote on 23 Feb 2017 in
microsoft.public.scripting.vbscript: 

> Evertjan I really don't  need your condescending attitude.

Dear Scot,

This NG is not to care for your needs, Usenet-NGs are discussion-groups.

> Pack your ego away if your here to help.  

And they are not helpdesks, where the OP can define the limits of the 
resopnses.

> "Why would it need error-checking if it works? "  REALLY ?    

Please do not shout on Usenet, this is not a presidential rally.

Yes really.

If you want to do error-checking, it is good programming practice that you 
define what errors you want to check and what not.

For instance, you do not need to catch programming errors, like 
setRequestHeader-errors or trying to .send before .open, id the code "works". 

Perhaps you want to check if the destination is online?

I would not call that an error in casu strictior, but an intermittent nasty 
fact of life, but you could mean that.

So please tell what you really [!!] want instead of feeling wronged.

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

[toc] | [prev] | [next] | [standalone]


#11577

From"Mayayana" <mayayana@invalid.nospam>
Date2017-02-23 17:19 -0500
Message-ID<o8nn22$9d7$1@dont-email.me>
In reply to#11575
"Scot Needy" <scotrn@gmail.com> wrote

| Evertjan I really don't  need your condescending attitude.

  There are a few OCD types here. Unfortunately
for you, one of them seems to be the only person
who uses xmlhttp. :)

  If you need to fix the base64 conversion I have
VBScript for that, but I haven't done anything like
what you're trying, so I can't be helpful on that score.

[toc] | [prev] | [next] | [standalone]


#11579

FromScot Needy <scotrn@gmail.com>
Date2017-02-23 19:32 -0800
Message-ID<2f7abc56-2f22-4112-90b0-9f9e32db5322@googlegroups.com>
In reply to#11577
On Thursday, February 23, 2017 at 5:19:33 PM UTC-5, Mayayana wrote:
> "Scot Needy" <scotrn@gmail.com> wrote
> 
> | Evertjan I really don't  need your condescending attitude.
> 
>   There are a few OCD types here. Unfortunately
> for you, one of them seems to be the only person
> who uses xmlhttp. :)
> 
>   If you need to fix the base64 conversion I have
> VBScript for that, but I haven't done anything like
> what you're trying, so I can't be helpful on that score.

Thanks Mayayana, I tried using a inline encoder like below but viewing the TCP dump it was not encoding it correctly and I actually like have a encoded password in my script now.  
It might be simple to crack but at least it's not out there in plain text.  We have a password vault that stored the real id/password if it's needed. 

Probably could have got this working if I played with it more. 
XMLHTTP.setRequestHeader "Authorization", "Basic " & Base64Encode(apikey & ":" & pass) 

I have the simple post working now but I pulled out all the guts to make it a simple as possible to debug any "unknown errors". Now I just need to put the obvious error checking back.  A alert script that fails with no warning is not worth a kb. 


 

[toc] | [prev] | [next] | [standalone]


#11581

From"Mayayana" <mayayana@invalid.nospam>
Date2017-02-23 23:07 -0500
Message-ID<o8obeb$os2$1@dont-email.me>
In reply to#11579
"Scot Needy" <scotrn@gmail.com> wrote

| Thanks Mayayana, I tried using a inline encoder like below but viewing the 
TCP dump it was not encoding it correctly and I actually like have a encoded 
password in my script now.
|

  If you end up needing it, see here:

http://www.jsware.net/jsware/scrfiles.php5#bints

The file Basic Base64- Encode- Decode.vbs in the download
contains 2 compact, all-VBS functions to encode/decode.

[toc] | [prev] | [next] | [standalone]


#11582

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2017-02-24 09:17 +0100
Message-ID<XnsA7265E85EDDE6eejj99@194.109.6.166>
In reply to#11581
"Mayayana" <mayayana@invalid.nospam> wrote on 24 Feb 2017 in
microsoft.public.scripting.vbscript: 

> "Scot Needy" <scotrn@gmail.com> wrote
> 
>| Thanks Mayayana, I tried using a inline encoder like below but viewing
>| the 
> TCP dump it was not encoding it correctly and I actually like have a
> encoded password in my script now.
>|
> 
>   If you end up needing it, see here:
> 
> http://www.jsware.net/jsware/scrfiles.php5#bints
> 
> The file Basic Base64- Encode- Decode.vbs in the download
> contains 2 compact, all-VBS functions to encode/decode.

The below looks promising [but not tested by me], 
given that the Q is how to use json in and output with cscript and vbs,
with base64 encoding:

<https://coderwall.com/p/ljvj-g/unlikely-coding-a-vbscript-posting-to-a-
rest-api>



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

[toc] | [prev] | [next] | [standalone]


#11583

From"Mayayana" <mayayana@invalid.nospam>
Date2017-02-24 10:22 -0500
Message-ID<o8pivv$f3e$1@dont-email.me>
In reply to#11582
"Evertjan." <exxjxw.hannivoort@inter.nl.net> wrote

| The below looks promising [but not tested by me],
| given that the Q is how to use json in and output with cscript and vbs,
| with base64 encoding:
|
| <https://coderwall.com/p/ljvj-g/unlikely-coding-a-vbscript-posting-to-a-
| rest-api>
|

  You know more about this than I do. I've never
used xmlhttp, nor had any reason to do anything
similar. I was only addressing what I understood to
be a faulty Base64 routine. What you linked is a
routine to convert a URL to remove trigger characters. 

[toc] | [prev] | [next] | [standalone]


#12267

Fromdavidjsmith10@gmail.com
Date2020-01-13 09:15 -0800
Message-ID<17252c79-3509-45b5-b025-6e0f65114bc5@googlegroups.com>
In reply to#11568
Hi all, related to this origional post,,,,,  for base64encode, there is a known issue. When the encoding the 76th character encoding inserts a vbLf  Chr(10). Use vbscript statement to remove that character string.

strEnc = Replace(strEnc, vbLf, "")

https://stackoverflow.com/questions/41837881/base64-encode-with-stream-stringtobinary-inserts-a-newline-breaking-the-string

[toc] | [prev] | [standalone]


Back to top | Article view | microsoft.public.scripting.vbscript


csiph-web