API & Macros - Can't add attachments



已于 2023年3月28日 发布

In summary I'm trying to build a Powershell script that is going to allow a couple of my users update the attachment to an existing macro without giving them admin access.

As far as I can tell there's no way to remove an existing attachment and insert a new attachment to a macro, so I'm building the script to delete the existing macro and create a new one with the updated attachment.

I have uploaded a file (in this case, a JPEG as a test) using the API via Postman which was a success. I am now trying to create a macro and attach the image, but I keep getting a 400 Bad Request.

Uri I am using is https://nutripath.zendesk.com/api/v2/macros.json

Here is the body of the request:
{
    "macro":{
        "title": "BF_Test_3",
        "actions": [{"field": "status", "value": "open"}],
        "active": "true",
        "attachments": [
            16919163324185
        ]
    }
}

 

The attachment exists because if I GET https://nutripath.zendesk.com/api/v2/attachments/16919163324185.json I get the below response.

{
    "attachment": {
        "url": "https://redacted.zendesk.com/api/v2/attachments/16919163324185.json",
        "id": 16919163324185,
        "file_name": "20230203121449.jpg",
        "content_url": "https://redacted.zendesk.com/attachments/token/redacted/?name=20230203121449.jpg",
        "mapped_content_url": "https://redacted.zendesk.com/attachments/token/redacted/?name=20230203121449.jpg",
        "content_type": "image/jpeg",
        "size": 3322588,
        "width": null,
        "height": null,
        "inline": false,
        "deleted": false,
        "malware_access_override": false,
        "malware_scan_result": "malware_not_found",
        "thumbnails": []
    }
}

Am I missing something obvious here?


0

5

0 条评论

登录以发表评论。

找不到所需的内容?

新建帖子