Symptom
You want to download the files attached to your documents (Opportunities, Service Requests, Leads, etc.) by making use of the OData Service.
Environment
SAP Cloud for Customer
Resolution
- Access the URL for the desired OData collection you want to use, for this test we will use the ServiceRequestCollection object.
- After using the URL for the object, i.e., https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/ServiceRequestCollection('Object ID')? . (Replace XXXXXX with your system number after "my". The Object ID here is that of a service request.)
- Expand the attachment folder by adding $expand=ServiceRequestAttachmentFolder at the end of the URL.
- Use the link provided in the property “id” that is like this: https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/servicerequest/ServiceRequestAttachmentFolderCollection('Object ID'). (The Object ID here is that of an attachment. )
- Append the segment /Binary/$value to the end of the link above and access the link.
- The corresponding attachment will be downloaded.
Keywords
Download attachments, OData services, OData API , KBA , LOD-CRM-INT-API , OData API (C4C Only) , AP-RC-ODF , OData framework (C4C Only) , How To
Product
SAP Cloud for Customer add-ins all versions