Adding news via REST API
Can someone provide some (or any) guidance on the XML syntax for news creation via API? Patch #13468. I am new to Redmine. Thanks.
After inspecting the link by Bernhard below, I was able to draft the following code in VBA, but still, I am not able to POST news to my localhost/Redmine.
I wonder what I am doing wrong. My Redmine Install is version 4.1.0.stable.
Example for Creating News
POST /projects/:project_id/news.xml <?xml version="1.0"?> <news> <title>Sample_title</title> <summary>Example</summary> <description>Sample Description</description> </news>
VBA Sample Code
Private Sub News() Dim req As New MSXML2.XMLHTTP60 Dim reqURL As String Dim reqBody As String reqURL = "http://localhost/redmine/projects/_0000067/news.xml" req.Open "POST", reqURL, False req.setRequestHeader "Content-Type", "application/xml" reqBody = "<?xml version=" & Chr(34) & "1.0" & Chr(34) & "encoding=" & Chr(34) & "UTF-8" & Chr(34) & " ?>" reqBody = reqBody & "<news>" reqBody = reqBody & "<title>" & "Test_Title" & "</title>" reqBody = reqBody & "<summary>" & "Test_Summary" & "</summary>" reqBody = reqBody & "<description>" & "Test_Description" & "</description>" reqBody = reqBody & "</news>" req.send (reqBody) End Sub
RE: Adding News vía Rest Api - Added by Bernhard Rohloff about 1 year ago
I haven't tried the news API, yet. But one can find good examples in the tests for that part. There you have prototypes for all kinds of requests.
RE: Adding news via REST API - Added by Leonid Konov 11 months ago
I have success with adding news
curl -v --header "Content-Type:application/xml;charset=UTF-8" -u "user:pass" --data @xmltest.xml http://host:port/projects/1/news.xml
<summary>News XML-API Test</summary>
<description>This is the description</description>
Redmine responds 204 No Content, but creates news entry.