Oracle CRM On Demand REST API Developer's Guide > Using the Oracle CRM On Demand REST API > Working with Resource Attachments >

Adding or Updating an Attachment


You can add or update an Oracle CRM On Demand resource attachment with an attachment specified in the request by sending an HTTP PUT request to the resource's URL.

NOTE:  The HTTP PUT method is only supported for Add and Update REST API operations for enclosure attachments. The request and response attachment data are in Base64 Encoding.

The following details are for a request to add or update an attachment on the Oracle CRM On Demand Server:

  • URL: https://<host>/OnDemand/user/Rest/latest/CustomObjects8/1QA2-1S4YSD/enclosure/Attachment
  • HTTP Method: PUT
  • Content-Type: json
  • Request body:

{"CustomObjects8":[
  {
    "Attachment":"Q3JpY2tldCBpcyBhIGJhdC1hbmQtYmFsbCBnYW1lIHBsYXllZCBiZXR3ZWVuIHR3byB0ZWFtcyBvZiAxMSBwbGF5ZXJzIGVhY2ggb24gYSBmaWVsZCBhdCB0aGUgY2VudHJlIG9mIHdoaWNoIGlzIGEgcmVjdGFuZ3VsYXIgMjIteWFyZCBsb25nIHBpdGNoLiBFYWNoIHRlYW0gdGFrZXMgaXRzIHR1cm4gdG8gYmF0LCBhdHRlbXB0aW5nIHRvIHNjb3JlIHJ1bnMsIHdoaWxlIHRoZSBvdGhlciB0ZWFtIGZpZWxkcy4gRWFjaCB0dXJuIGlzIGtub3duIGFzIGFuIGlubmluZ3Mu",
    "AttachFileName":"Cricket",
    "AttachFileExt":"txt"}]
  }

The following are the details for the response to a successful request:

  • HTTP Code: 200
  • Content-Type: <enclosure dependent>
  • Location: https://<host>/OnDemand/user/Rest/latest/CustomObjects8/1QA2-1S4YSD/enclosure/Attachment
  • Response body:

{"CustomObjects8":[
  {
    "Attachment":"Q3JpY2tldCBpcyBhIGJhdC1hbmQtYmFsbCBnYW1lIHBsYXllZCBiZXR3ZWVuIHR3byB0ZWFtcyBvZiAxMSBwbGF5ZXJzIGVhY2ggb24gYSBmaWVsZCBhdCB0aGUgY2VudHJlIG9mIHdoaWNoIGlzIGEgcmVjdGFuZ3VsYXIgMjIteWFyZCBsb25nIHBpdGNoLiBFYWNoIHRlYW0gdGFrZXMgaXRzIHR1cm4gdG8gYmF0LCBhdHRlbXB0aW5nIHRvIHNjb3JlIHJ1bnMsIHdoaWxlIHRoZSBvdGhlciB0ZWFtIGZpZWxkcy4gRWFjaCB0dXJuIGlzIGtub3duIGFzIGFuIGlubmluZ3Mu",
    "AttachFileName":"Cricket",
    "AttachFileExt":"txt"}]
  }

Oracle CRM On Demand REST API Developer's Guide, Release 34 Revision A Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Legal Notices.