Project

General

Profile

Updating an Issue via REST-API with Excel VBA

Added by Patricio Iglesias over 9 years ago

Hello, this is my first post so sorry if i miss some info.

Im trying to update an issue from excel, with VBA. My code:

Dim urlRedmine As String
urlRedmine = "http://myurl/redmine/issues/683.xml" '683 is the id of issue im trying to change as an example

Set req = CreateObject("Msxml2.ServerXMLHTTP.6.0")
req.Open "POST", urlRedmine, False
req.SetRequestHeader "Content-Type", "application/xml"
req.SetRequestHeader "Authorization", "Basic base64encodeusu:pwd"

Dim xml As String
xml = "<issue><subject>changed_subject</subject></issue>"
req.Send (xml)

As response i get an error 405, Method not allowed.

I have tried so hard, but unfortunately im unable to find the problem.

Can anyone help me please?


Replies (3)

RE: Updating an Issue via REST-API with Excel VBA - Added by Patricio Iglesias over 9 years ago

At least i´ve got it. Changed httprequest method to "PUT".

RE: Updating an Issue via REST-API with Excel VBA - Added by Patricio Iglesias over 9 years ago

but now i have the problem that status can not be updated.

My XML is like:

<issue>
<status name="Cerrada" id="5"/>
</issue>

but it doesn´t work. Any ideas?

RE: Updating an Issue via REST-API with Excel VBA - Added by Patricio Iglesias over 9 years ago

Ok, working fine.

The xml is a bit different to PUT then the extracted from the GET:

<issue>
<status_id>5</status_id>
<done_ratio>100</done_ratio>
</issue>

    (1-3/3)