Getting 405 Not Allowed when sending cancel

The documentation gives the following format for cancelling a specific order:
DELETE /v2/orders/{order_id}

However, when I use Access VBA to send the DELETE message it returns a “405 Not Allowed” error. POST and GET methods are working fine.

(API key and secret are set in constants earlier)

Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
Const strEndPoint As String = ""

(myBrkrId is a string containing the Alpaca order ID)

payload_json = "{""" & myBrkrId & """}"
Debug.Print strEndPoint & payload_json

objHTTP.Open "DELETE", strEndPoint, False
objHTTP.Send payload_json

Debug.Print objHTTP.STATUS

byteData = objHTTP.responseBody

Set objHTTP = Nothing

ALPCXLORDER = StrConv(byteData, vbUnicode)

Resulting API call:{“e2fdba6a-a01b-401f-92b9-6d4eb5c9fba8”}

1 Like

Never mind. Realized the order ID is just included after the forward slash without any brackets or quotes


1 Like

Nice, thanks for the report. This will be helpful for others to search the issue.