Classic ASP
Classic ASP
Send a Bodyless REST Request into a StringBuilder
See more REST Examples
Demonstrates Rest.FullRequestNoBodySb, which sends a request with no body and stores the text response body in a StringBuilder.
Background. This variant of the no-body full request writes the response into a StringBuilder rather than returning it as a string, which is convenient when the response will be further processed in place.
Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
set rest = Server.CreateObject("Chilkat.Rest")
bTls = 1
bAutoReconnect = 1
success = rest.Connect("example.com",443,bTls,bAutoReconnect)
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( rest.LastErrorText) & "</pre>"
Response.End
End If
' FullRequestNoBodySb sends a request with no body and stores the text response body in a
' StringBuilder.
set sbResponse = Server.CreateObject("Chilkat.StringBuilder")
success = rest.FullRequestNoBodySb("GET","/api/items/123",sbResponse)
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( rest.LastErrorText) & "</pre>"
Response.End
End If
responseText = sbResponse.GetAsString()
If (sbResponse.LastMethodSuccess = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( sbResponse.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( responseText) & "</pre>"
%>
</body>
</html>