Hi all,
as the title suggests im looking to try and automate creating jira's but running into problems when trying to post.
The authorization code seems to work as there's no failure when i use GET.
the JSON seems to be ok.
The error i recieve is "XSRF check failed" which upon research suggests im missing an additional authorisation step when posting data but i can't work out what's missing.
Private JiraService As New MSXML2.XMLHTTP30 Private arrData() As Byte Sub Test() Dim objRequest As Object Dim blnAsync As Boolean Dim strResponse As String Dim UserName, Password As String Dim sURL, strURL As String UserName = "XXXX" Password = "XXXXX" Call isAuthorized Set objRequest = CreateObject("MSXML2.XMLHTTP") sURL = "https://jira.XXX.com" m_sJSONString = json_Formatter() With objRequest .Open "POST", sURL & "/rest/api/2/issue/", False .setRequestHeader "Content-Type", "application/json" .setRequestHeader "Accept", "application/json" .setRequestHeader "Authorization", "Basic " & EncodeBase64 .send m_sJSONString If .Status <> 401 Then m_sJSONString = .responseText Else m_sJSONString = "Error: Invalid Credentials!" End If End With Debug.Print m_sJSONString End Sub



Reply With Quote
