Chilkat Online Tools

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

Back to Collection Items

' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

Dim http As New ChilkatHttp
Dim success As Long

Dim bdRequestBody As New ChilkatBinData
success = bdRequestBody.LoadFile("file")
If (success <> 1) Then
    Debug.Print "Failed to load file"
    Exit Sub
End If

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

Dim resp As ChilkatHttpResponse
Set resp = http.PBinaryBd("PUT","https://domain.com/",bdRequestBody,"{{partner_resource_mimeType}}",0,0)
If (http.LastMethodSuccess = 0) Then
    Debug.Print http.LastErrorText
    Exit Sub
End If

Debug.Print resp.StatusCode
Debug.Print resp.BodyStr

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": "42a10928-705a-4438-8ebe-34ff972cc25d",
  "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": [
  ]
}