Public Function GetResponse(URI As String) As Boolean
Dim oHTTRequest As New WinHttp.WinHttpRequest
Dim oResult As String
On Error GoTo ErrRequest
oHTTRequest.Option(WinHttpRequestOption_EnableHttp1_1) = False
oHTTRequest.Open "GET", URI, False
oHTTRequest.setRequestHeader "X-Cons-ID", "XXXXXX (your cons-id)"
oHTTRequest.setRequestHeader "X-Timestamp", "XXXXX (timestamp)"
oHTTRequest.setRequestHeader "X-Signature", "XXXXX (your signature)"
oHTTRequest.send
If oHTTRequest.Status = 200 Then
GetResponse = True
oResult = oHTTRequest.responseText
Else
GetResponse = False
oResult = oHTTRequest.responseText
End If
Set oHTTRequest = Nothing
Exit Function
ErrRequest:
Set oHTTRequest = Nothing
GetResponse = False
Err.Raise Err.Number, ", Err.Description"
End Function
Public Function PutResponse(URI As String) As Boolean
Dim oHTTRequest As MSXML2.XMLHTTP30
Dim oResult As String
On Error GoTo ErrRequest
Set oHTTRequest = New MSXML2.XMLHTTP30
oHTTRequest.Open "PUT", URI, False
oHTTRequest.setRequestHeader "X-Cons-ID", "XXXXXX (your cons-id)"
oHTTRequest.setRequestHeader "X-Timestamp", "XXXXX (timestamp)"
oHTTRequest.setRequestHeader "X-Signature", "XXXXX (your signature)"
oHTTRequest.setRequestHeader "Content-Type", "text/xml"
oHTTRequest.send "XML Data Put?"
oResult = oHTTRequest.responseText
If oHTTRequest.Status = 201 Or oHTTRequest.Status = 200 Then
PostResponse = True
Else
PostResponse = False
End If
Set oHTTRequest = Nothing
Exit Function
ErrRequest:
PostResponse = False
Err.Raise Err.Number, ", Err.Description"
End Function
Public Function PostResponse(URI As String) As Boolean
Dim oHTTRequest As MSXML2.XMLHTTP30
Dim oResult As String
On Error GoTo ErrRequest
Set oHTTRequest = New MSXML2.XMLHTTP30
oHTTRequest.Open "POST", URI, False
oHTTRequest.setRequestHeader "X-Cons-ID", "XXXXXX (your cons-id)"
oHTTRequest.setRequestHeader "X-Timestamp", "XXXXX (timestamp)"
oHTTRequest.setRequestHeader "X-Signature", "XXXXX (your signature)"
oHTTRequest.setRequestHeader "Content-Type", "text/xml"
oHTTRequest.send "XML Data Post?"
oResult = oHTTRequest.responseText
If oHTTRequest.Status = 201 Or oHTTRequest.Status = 200 Then
PostResponse = True
Else
PostResponse = False
End If
Set oHTTRequest = Nothing
Exit Function
ErrRequest:
PostResponse = False
Err.Raise Err.Number, ", Err.Description"
End Function
Public Function DeleteResponse(URI_Response As String) As Boolean
Dim oHTTRequest As MSXML2.XMLHTTP30
Dim oResult As String
On Error GoTo ErrRequest
Set oHTTRequest = New MSXML2.XMLHTTP30
oHTTRequest.Open "DELETE", URI, False
oHTTRequest.setRequestHeader "X-Cons-ID", fields.xConsID
oHTTRequest.setRequestHeader "X-Timestamp", fields.xTimeStamp
oHTTRequest.setRequestHeader "X-Signature", fields.xSignature
oHTTRequest.setRequestHeader "Content-Type", "text/xml"
oHTTRequest.send "XML Data Delete?"
oResult = oHTTRequest.responseText
If oHTTRequest.Status = 201 Or oHTTRequest.Status = 200 Then
DeleteResponse = True
Else
DeleteResponse = False
End If
Set oHTTRequest = Nothing
Exit Function
ErrRequest:
DeleteResponse = False
Err.Raise Err.Number, ", Err.Description"
End Function