Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function submit_call(endpoint, verb, data, apiKey)
- Dim bpreq, post_response
- Set bpreq = server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
- bpreq.Open verb, endpoint, False
- 'if not (verb = "POST") then
- ' bpreq.SetRequestHeader "X-HTTP-Method-Override", verb
- ' end if
- bpreq.SetRequestHeader "Content-Type", "application/json"
- bpreq.SetRequestHeader "Authorization", "apikey " & apiKey
- On Error Resume Next
- bpreq.Send(data)
- If Err.Number = 0 Then
- If bpreq.Status = "200" Then
- submit_call = bpreq.ResponseText
- Else
- submit_call = "Endpoint: " & endpoint & ", HTTP " & bpreq.Status & " " & bpreq.StatusText
- End If
- Else
- submit_call = "Error " & Err.Number & " " & Err.Source & " " & Err.Description
- End If
- On Error GoTo 0
- Set bpreq = Nothing
- End function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement