CRM and CX Blogs by Members
Find insights on SAP customer relationship management and customer experience products in blog posts from community members. Post your own perspective today!
cancel
Showing results for 
Search instead for 
Did you mean: 
TAWANO
Explorer
The new library object provided on the previous releases allow you to implement integration using ODATA.

Unfortunatelly this is not available on the standard C4CODATAAPI odata, which means you need to create your own custom ODATA selecting the entities from the new library.

In this blog I will explain how to create it and explain some tips to make this integration possible.

CREATING YOUR CUSTOM ODATA:

First step is create a custom odata for the object DOCUMENT_FACADE and select the required services to implement the integration. In my case this is how it was activated:



CONSUMING THE API:

In my example it was necessary to create the folder structure and in the last step integrate the file to this folder. For you to integrate the file, you need to convert the content to BASE64 and pass it in the payload.

See below the steps to implement this integration:

1- Create the root folder:

ODATA: https://yourtenanturl/sap/c4c/odata/cust/v1/document_facade/DocumentFacadeCollection
Méthod: POST()

Parameter:

DocumentFacadeTypeCode = 1

2- Create the document to the created folder:

ODATA: https://yourtenanturl/sap/c4c/odata/cust/v1/document_facade/DocumentFacadeCollection
Méthod: POST()

Parameter:

DocumentFacadeTypeCode = 2

ParentReferenceUUID = ObjectID from folder created

3- Searching the document created by the system

This document is created automatically by the system when you execute the second step and you need its objectID to dig in the next levels of the structure.

ODATA:
https://yourtenanturl/sap/c4c/odata/cust/v1/document_biblioteca/DocumentCollection
Méthod: GET()
Parameters:
Name = Name from the object created on the 3th step

Result:
Save the objectID from the search result

4- Searching the document version created by the system

This document version is created automatically by the system when you execute the second step and you need its objectID to dig in the next levels of the structure.

ODATA:
https://yourtenanturl/sap/c4c/odata/cust/v1/document_biblioteca/DocumentVersionCollection
Méthod: GET()
Parameters:
ParentObjectID = ObjectID from the object searched on the 3th step

Result:
Save the objectID from the search result

5- Searching the FileObject created by the system

This empty file is created automatically by the system when you execute the second step and you need its objectID to execute an update passing the file content.

ODATA:
https://yourtenanturl/sap/c4c/odata/cust/v1/document_biblioteca/DocumentVersionFileVariantCollection
Méthod: GET()
Parameters:
ParentObjectID = ObjectID from the searched on the 4th step

Result:
Save the objectID from the search result

6- Uploading the content file (last step)

ODATA:
https://yourtenanturl/sap/c4c/odata/cust/v1/document_biblioteca/DocumentVersionFileVariantCollection
Méthod: PATCH()
Parameters:
ParentObjectID = ObjectID from the searched on the 5th step
BynaryObject = Content from the file already converted
MimeCode = the type file, for example "application/pdf" for PDF files

Result:
You have uploaded files to a folder from the new library using Odata API

TIPS:

  • If you already have the folder structure, you dont need to execute the steps 1 and 2. You just need to dig in the structure to obtain the document OBJECTID you want to upload the file.

  • In the object DOCUMENTFACADE it is mandatory an EMPLOYEE ASSIGNED to the folder. When it is created manually in the system, it is automatically assigned to your business partner (assigned to your user). Via API there is no option for you to pass the business employee, which means you need to use a BUSINESS USER in the the authentication method of your API instead of use an ODATA Communication arrangement (technical user).


Thank you very much!