免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
redmine,通過代碼修改創(chuàng)建提交記錄 附件等 API with curl

Using the REST API with cURL?

curl is a command-line tool for transferring data using various protocols. It can be used to interact with the Redmine REST API.

Using JSON

Here is a simple example of a command that can be used to update an issue:

curl -v -H "Content-Type: application/json" -X PUT --data-binary "@388.json" -u login:password http://redmine/issues/388.jsoncurl -v -H "Content-Type: application/json" -X PUT --data-binary "@388.json" -H "X-Redmine-API-Key: xxxx" http://redmine/issues/388.json

The file that contains the data sent to Redmine (388.json in the example above) would look like this:

{  "issue": {    "subject": "subject123",    "notes": "Changing the subject"   }}
Note: it's required to set the Content-Type header according to the format of the data you are sending. It must be set to one the following values:
  • application/json
  • application/xml

Using XML

Here is a simple example of a command that can be used to create an issue with custom fields:

curl -v -H "Content-Type: application/xml" -X POST --data-binary "@issue.xml" -u login:password http://redmine/issues.xmlcurl -v -H "Content-Type: application/xml" -X POST --data-binary "@issue.xml" -H "X-Redmine-API-Key: xxxx" http://redmine/issues.xml

Where issue.xml content is:

<?xml version="1.0" encoding="ISO-8859-1" ?><issue>  <subject>API custom fields</subject>  <project_id>1</project_id>  <tracker_id>2</tracker_id>  <custom_fields type="array">    <custom_field>      <id>2</id>      <value>Fixed</value>    </custom_field>    <custom_field>      <id>1</id>      <value>0.8.2</value>    </custom_field>  </custom_fields></issue>

Text formatting

If you want to use some text formatting (e.g to update a wiki page on your project), you should make sure to use curl's option --data-binary instead of --data to load the file. Only that way, curl will send newline characters unchanged and will retain all formatting.

curl -v -H "Content-Type: application/xml" -X PUT --data-binary "@wiki.xml" -u login:password http://redmine/projects/foo/wiki/page_test.xml

Where wiki.xml content is:

<?xml version="1.0"?><wiki_page><text>h1. TITLE %{font-size:14pt}SUBTITLE%</text></wiki_page>

Attaching files

If you want to create an issue with image.png attached, you need to upload this file first:

curl --data-binary "@image.png" -H "Content-Type: application/octet-stream" -X POST -u login:password http://redmine/uploads.xml# 201 response<upload>  <token>7167.ed1ccdb093229ca1bd0b043618d88743</token></upload>

Then, use the token to create the issue:

curl -v -H "Content-Type: application/xml" -X POST --data-binary "@issue.xml" -u login:password http://redmine/issues.xml

Where issue.xml content is:

<?xml version="1.0" encoding="ISO-8859-1" ?><issue>  <subject>Issue with attachment</subject>  <project_id>1</project_id>  <uploads type="array">    <upload>      <token>7167.ed1ccdb093229ca1bd0b043618d88743</token>      <filename>image.png</filename>      <content_type>image/png</content_type>    </upload>  </uploads></issue>
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
獲取Jenkins project build結(jié)果
如何通過gzip和nginx來提高網(wǎng)站打開速度及整體性能
HTTP API 設(shè)計指南
聽不懂人話?stata分詞幫你搞定(四)
前后端對接的思考及總結(jié)
使用curl指令模擬HTTP請求
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服