Quantcast
Channel: Discussion Forum > Connect Data Services
Viewing all articles
Browse latest Browse all 2504

Creating file attachment with REST API fails when following sample code (2 Comments)

$
0
0

Topic by Jared

When attempting to create an attachment with the new REST API, it fails:

I follow the doc (http://documentation.custhelp.com/euf/assets/devdocs/november2015/Connect_REST_API/wwhelp/wwhimpl/js/html/wwhelp.htm#href=Connect_REST_API.1.18.html), doing a POST to https://xxxyyyzzz.custhelp.com/services/rest/connect/v1.3/incidents/20/fileAttachments with body from the doc example:
{
"fileName":"SampleFileAttachment.txt ",
"data":"c2FtcGxlIGNvbnRlbnQgZm9yIGZpbGUgYXR0YWNobWVudA=="
}

The response is a 400 Error:
{
    "type": "https://xxxyyyzzz.custhelp.com/services/rest/connect/exceptions/OSC-CREST-00012",
    "title": "Problem creating resource",
    "status": 400,
    "detail": "Error attempting to create resource: File specified could not be found: /tmp/c2FtcGxlIGNvbnRlbnQgZm9yIGZpbGUgYXR0YWNobWVudA==",
    "instance": "https://xxxyyyzzz.custhelp.com/services/rest/connect/v1.3/incidents/20/fileAttachments",
    "o:errorCode": "OSC-CREST-00012"
}

Can please someone have a look at this?

PS: I also tried to use a form as described in the same api doc (Uploading file attachments by using HTML forms) with no success, error was this time:
{
    "type": "https://xxxyyyzzz.custhelp.com/services/rest/connect/exceptions/OSC-CREST-00011",
    "title": "Bad JSON syntax found in the request",
    "status": 400,
    "detail": "JSON (JavaScript Object Notation) is a lightweight, text-based, language-independent data interchange format. It is defined by IETF RFC 7159 which is found here: https://tools.ietf.org/html/rfc7159 . The request that was made violated the rules for JSON syntax which made the request unreadable. Please correct your syntax errors and try your request again.",
    "instance": "https://xxxyyyzzz.custhelp.com/services/rest/connect/v1.3/incidents/20/fileAttachments",
    "o:errorCode": "OSC-CREST-00011"
}

Thank you


Viewing all articles
Browse latest Browse all 2504

Trending Articles