Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(Excel) POST application/x-www-form-urlencoded using REST APIDemonstrates how to send a POST with query params (x-www-form-urlencoded) using the Chilkat REST object.
' This example requires the Chilkat API to have been previously unlocked. ' See Global Unlock Sample for sample code. Dim rest As Chilkat.Rest Set rest = Chilkat.NewRest ' This example will send to https://www.chilkatsoft.com/echoPost.asp ' Make the initial connection (without sending a request yet). bTls = True port = 443 bAutoReconnect = True success = rest.Connect("www.chilkatsoft.com",port,bTls,bAutoReconnect) If (success <> True) Then Debug.Print rest.LastErrorText Exit Sub End If ' Provide query params. Dim success As Boolean success = rest.AddQueryParam("firstName","John") success = rest.AddQueryParam("lastName","Doe") success = rest.AddQueryParam("company","Bisco Bits Ltd.") responseStr = rest.FullRequestFormUrlEncoded("POST","/echoPost.asp") If (rest.LastMethodSuccess <> True) Then Debug.Print rest.LastErrorText Exit Sub End If ' When successful, the response status code will equal 200. If (rest.ResponseStatusCode <> 200) Then ' Examine the request/response to see what happened. Debug.Print "response status code = "; rest.ResponseStatusCode Debug.Print "response status text = "; rest.ResponseStatusText Debug.Print "response header: "; rest.ResponseHeader Debug.Print "response body (if any): "; responseStr Debug.Print "---" Debug.Print "LastRequestStartLine: "; rest.LastRequestStartLine Debug.Print "LastRequestHeader: "; rest.LastRequestHeader Exit Sub End If Debug.Print responseStr Debug.Print "Success." |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.