Apostrophe CMS API从附件创建图像

时间:2018-08-29 10:16:05

标签: api apostrophe-cms

我已按照https://github.com/apostrophecms/apostrophe-headless#attachment-fields上传了png,并获得了以下内容;

{"_id":"cjlexm6ul000j7ewxnjnse382",
"group":"images",
"createdAt":"2018-08-29T09:22:20.817Z",
"name":"sample1",
"title":"sample1",
"extension":"png",
"type":"attachment",
"docIds":[],
"trashDocIds":[],
"length":226119,
"md5":"3e150a6013f8ea2ffacbbe5a5122a668",
"width":1712,
"height":2537,
"portrait":true,
"ownerId":"cjlcqq0bw000e4qwxpx2cm75u"
}

很好,但是在将其转换为图像时遇到问题。我已尝试根据https://github.com/apostrophecms/apostrophe-headless#working-with-apostrophe-images-and-apostrophe-files

将此休假添加到POST请求中
{
    "title": "sample1",
    "slug": "sample1",
    "attachment": {
    "_id": "cjlexm6ul000j7ewxnjnse382",
    "group": "images",
    "createdAt": "2018-08-29T09:22:20.817Z",
    "name": "sample1",
    "title": "sample1",
    "extension": "png",
    "type": "attachment",
    "docIds": [],
    "trashDocIds": [],
    "length": 226119,
    "md5": "3e150a6013f8ea2ffacbbe5a5122a668",
    "width": 1712,
    "height": 2537,
    "portrait": true,
    "ownerId": "cjlcqq0bw000e4qwxpx2cm75u"
  }
}

我回来了

  

SyntaxError:JSON中位置0处出现意外令牌

在服务器上...

还有其他可以尝试的想法吗?

0 个答案:

没有答案