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

Adding Attachments


You can add Oracle CRM On Demand attachments by sending an HTTP POST request to the resource's URL.

NOTE:  The request and response attachment data are in Base64 Encoding.

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

  • URL: https://<host>/OnDemand/user/Rest/latest/CustomObjects4/ABCD-1234/enclosure/Attachment
  • HTTP Method: POST
  • Content-Type: application/vnd.oracle.adf.resource+json
  • Request body:

{
         "CustomObjects4" : [ {
     ...other CO4 fields...
   "Attachment" : "iVBORw0KGgoAAAANSUhEUg.....FTkSuQmCC"
         }
        ]
}

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

  • HTTP Code: 201
  • Content-Type: application/vnd.oracle.adf.resource+json
  • Location: https://<host>/OnDemand/user/Rest/latest/CustomObjects4/ABCD-1234
  • Response body:

{
         "CustomObjects4" : [ {
     ...other CO4 fields...
        "Attachment" : "iVBORw0KGgoAAAANSUhEUg.....FTkSuQmCC"
           "links" : {
              "self" : {
              "rel" : "self",
              "href" : "/OnDemand/user/Rest/latest/CustomObjects4/ABCD-1234"
            },
            "canonical" : {
               "rel" : "canonical",
               "href" : "/OnDemand/user/Rest/latest/CustomObjects4/ABCD-1234"
            },
            "Attachment" : {
               "rel" : "enclosure",
               "href" : "/OnDemand/user/Rest/latest/CustomObjects4/ABCD-1234/enclosure/Attachment"
            ...

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