上传附件

POST /apiv2/attachments.json

注意:需要在url里添加filename参数来设置附件文件名

同一个附件只能对应一个工单或一个工单回复或一个文档

请求header里需要设置"Content-Type: application/binary"

POST /apiv2/attachments.json?filename=test.jpg
curl 示例
curl -u {email_address}:{password} -H "Content-Type: application/binary" \
   --data-binary @hello.gif -X POST \
   https://{subdomain}.kf5.com/apiv2/attachments.json?filename=hello.gif
返回示例
Status: 201 Created
Location: https://{subdomain}.kf5.com/apiv2/attachments/{id}.json{
	"attachment": {
		"id": 1948,
		"url": "https://support.kf5.com/apiv2/attachments/1948.json",
		"name": "hello.gif",
		"size": 8238,
		"content_url": "https://support.kf5.com/attachments/download/1948/00154af5872418a7792dda0edb32921/",
		"token": "00154af5872418a7792dda0edb32921"
	}}

注意:上传附件,成功返回数据后,在提交工单的时候只需要将token值附带到uploads后面即可。

附带附件的创建工单示例
curl https://{subdomain}.kf5.com/apiv2/requests.json \
  -d '{"request": {"title": "Help!", "comment": {"content": "My new requests", "uploads": ["00156a9d6e82efefcbbd874ffbf617e","00156a9d6e82efefcbbd874ffbf617e"]}}}' \
  -v -u {email_address}/token:{api_token} -X POST -H "Content-Type: application/json"