Chilkat Online Tools

Classic ASP / EPC 2.0 - Partner Sandbox - 19.4 November [External] / Stream Resource

Back to Collection Items

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

set http = Server.CreateObject("Chilkat_9_5_0.Http")

set bdRequestBody = Server.CreateObject("Chilkat_9_5_0.BinData")
success = bdRequestBody.LoadFile("file")
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( "Failed to load file") & "</pre>"
    Response.End
End If

http.SetRequestHeader "Authorization","{{partner_resource_authorization_header}}"

' resp is a Chilkat_9_5_0.HttpResponse
Set resp = http.PBinaryBd("PUT","https://domain.com/",bdRequestBody,"{{partner_resource_mimeType}}",0,0)
If (http.LastMethodSuccess = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( http.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( resp.StatusCode) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( resp.BodyStr) & "</pre>"


%>
</body>
</html>

Curl Command

curl -X PUT
	-H "Authorization: {{partner_resource_authorization_header}}"
	-H "Content-Type: {{partner_resource_mimeType}}"
	--data-binary '@file'
https://domain.com/

Postman Collection Item JSON

{
  "name": "Stream Resource",
  "_postman_id": "94addbd1-0de1-43f5-b53e-2dc7306e407e",
  "request": {
    "method": "PUT",
    "header": [
      {
        "key": "Authorization",
        "value": "{{partner_resource_authorization_header}}",
        "type": "text"
      },
      {
        "key": "Content-Type",
        "value": "{{partner_resource_mimeType}}",
        "type": "text"
      }
    ],
    "body": {
      "mode": "file",
      "file": {
        "src": ""
      }
    },
    "url": "{{partner_resource_location}}"
  },
  "response": [
  ]
}