/
var
/
www
/
html
/
sugardemo
/
include
/
api
/
help
/
Upload File
HOME
<!-- /* * Your installation or use of this SugarCRM file is subject to the applicable * terms available at * http://support.sugarcrm.com/Resources/Master_Subscription_Agreements/. * If you do not agree to all of the applicable terms or do not have the * authority to bind the entity as an authorized representative, then do not * install or use this SugarCRM file. * * Copyright (C) SugarCRM Inc. All rights reserved. */ --> <h2>Overview</h2> <span class="lead"> Attaches a file to a field on a record. </span> <h2>Request Arguments</h2> <table class="table table-hover"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> <th>Required</th> </tr> </thead> <tbody> <tr> <td> format </td> <td> String </td> <td> The data format. Currently accepts 'sugar-html-json'. </td> <td> True </td> </tr> <tr> <td> delete_if_fails </td> <td> Boolean </td> <td> Indicates whether the API is to mark related record deleted if the file upload fails. </td> <td> False </td> </tr> <tr> <td> oauth_token </td> <td> String </td> <td> The oauth_token value. </td> <td> False - Required if only if delete_if_fails is true. </td> </tr> <tr> <td> <attachment field> </td> <td> String </td> <td> The field and file to populate. <br> Example: <code>{"<attachment field>":"@\/path\/to\/ExampleDocument.txt"}</code> </td> <td> True </td> </tr> </tbody> </table> <h3>Request</h3> <pre class="pre-scrollable"> { "format":"sugar-html-json", "delete_if_fails":true, "oauth_token":"43b6b327-cc70-c301-3299-512ffb99ad97", "<attachment field>":"@\/path\/to\/ExampleDocument.txt" } </pre> <h2>Response Arguments</h2> <table class="table table-hover"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <tr> <td> content-type </td> <td> String </td> <td> The files content type. </td> </tr> <tr> <td> content-length </td> <td> Integer </td> <td> The files content length. </td> </tr> <tr> <td> name </td> <td> String </td> <td> The files name. </td> </tr> <tr> <td> uri </td> <td> String </td> <td> The URI of the file. </td> </tr> </tbody> </table> <h3>Response</h3> <pre class="pre-scrollable"> { "content-type":"text\/plain", "content-length":16, "name":"ExampleDocument.txt", "uri":"http:\/\/sugarcrm\/rest\/v10\/Notes\/ca66c92f-5a8b-28b4-4fc8-512d099b790b\/file\/<attachment field>?format=sugar-html-json&delete_if_fails=1&oauth_token=6ec91cf3-1f97-25b9-e0b1-512f8971b2d4" } </pre> <h2>Change Log</h2> <table class="table table-hover"> <tr> <th>Version</th> <th>Change</th> </tr> <tr> <td> v10 </td> <td> Added <code>/<module>/:record/file/:field</code> POST endpoint. </td> </tr> </table>