Chilkat Online Tools

autoit / Binance spot API / Close a ListenKey (USER_STREAM)

Back to Collection Items

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

$oHttp = ObjCreate("Chilkat_9_5_0.Http")
Local $bSuccess

$oHttp.SetRequestHeader "Content-Type","application/json"
$oHttp.SetRequestHeader "X-MBX-APIKEY","{{binance-api-key}}"

Local $oResp = $oHttp.QuickRequest("DELETE","https://domain.com/api/v3/userDataStream?listenKey=listen-key")
If ($oHttp.LastMethodSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite($oResp.StatusCode & @CRLF)
ConsoleWrite($oResp.BodyStr & @CRLF)

Curl Command

curl -X DELETE
	-H "Content-Type: application/json"
	-H "X-MBX-APIKEY: {{binance-api-key}}"
https://domain.com/api/v3/userDataStream?listenKey=listen-key

Postman Collection Item JSON

{
  "name": "Close a ListenKey (USER_STREAM)",
  "request": {
    "method": "DELETE",
    "header": [
      {
        "key": "Content-Type",
        "type": "text",
        "value": "application/json"
      },
      {
        "key": "X-MBX-APIKEY",
        "value": "{{binance-api-key}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "{{url}}/api/v3/userDataStream?listenKey=listen-key",
      "host": [
        "{{url}}"
      ],
      "path": [
        "api",
        "v3",
        "userDataStream"
      ],
      "query": [
        {
          "key": "listenKey",
          "value": "listen-key",
          "description": "User websocket listen key"
        }
      ]
    },
    "description": "Close out a user data stream.\n\nWeight: 1"
  },
  "response": [
  ]
}