2325562 - Frequently Asked Question on OData Services

SAP Knowledge Base Article - Public

2325562 - Frequently Asked Question on OData Services

Symptom

Below are few commonly asked question and their answers on OData Services.

Resolution

Question 1:  How to access the SAP Hybris Cloud for Customer OData API of your tenant?

Answer:  You can access the OData API of your tenant by following the URL pattern: https://<your_tenant>/sap/c4c/odata/v1/c4codata

 

Question 2:  How to access the metadata of the OData API of your tenant?

Answer:  You can access the metadata of the OData API of your tenant with the URL pattern: https://<YourTenant>/sap/c4c/odata/v1/c4codata/$metadata

 

Question 3:  How to access OData API reference for all the objects?

Answer:  You can access OData API reference for all the objects with the URL pattern: https://help.sap.com/saphelp_sapcloudforcustomer/en/ODATA_APIs/index.html#ed2431cb0d484cd8a9fe60699856197b.html

 

Question 4:  Can ODATA V2 services be consumed in Cloud for Customer OData services?

Answer:  You can use the same URL https://<CloudTenant>/sap/c4c/odata/v1/c4codata/ for accessing ODATA V2 in Cloud for Customer

 

Question 5:  Is Initially Received At field available in standard OData service Cloud for Customer OData?

Answer:  You can use the field RequestedStart as a workaround. Addition of field Initially Received At will be available in one of our future releases.

 

Question 6:  How to create Contact Communication Data while creating Contacts using OData services?

Answer:  You have to first create AccountContactRelationship and then you can create ContactCommunicationData by adding communication data for Contacts

 

Question 7:  Is it possible to retrieve the Organizational Structure data using OData services?

Answer:  There is no OData API to retrieve Organizational Structure.

 

Question 8:  What are the different supported HTTP operations in OData?

Answer:  Below are the supported HTTP operations in OData

GET Used to retrieve a single entity instance or multiple entity instances
POST Used to create entity instances
PUT Used to completely replace/overwrite and existing entity instance
PATCH Used to replace/overwrite existing entity instance. The key difference between PUT and PATCH is that PUT overwrites the complete entity whereas PATCH updates only attributes of the entity that are part of the payload
DELETE Used to delete an entity record
$batch Used to perform multiple query, create, update and delete operations with explicit transaction boundaries specified via Changesets as a part of the payload
Deep Insert Used with POST. Allows the creation of complete entity (header entry, child entries, ...) with a single POST request

 

Question 9:  What is the use of Null checkbox while creating a Custom OData service?

Answer:  The Null checkbox will mark a property nullable as True. which makes the property as mandatory.

 

Question 10:  What is the use of Include Code Description checkbox while creating a Custom OData service?

Answer:  The Include Code Description checkbox will add the description of Property value in the metadata. Example: Property - Category Code and Category Code Text

 

Question 11:  What is the use of Enable Search checkbox while creating a Custom OData service?

Answer:  The Enable Search checkbox will enhance the property to the filter $search. The $search will look for the value in that property also.

 

Question 12:  How to use $count filter with $filter while using GET function?

Answer:  http://<TenantURL>/sap/c4c/odata/v1/c4codata/$count?$filter=AccountID eq 'XX'

 

Question 13:  Is it possible to Update/Delete/Export TextCollection Nodes via Data Workbench?

Answer:  Only Import is possible, Update can be done if External Keys are used via Import option itself.

 

Question 14:  Is it possible to automatically add all the Extension fields at once to an OData Service?

Answer:  The Extension fields need to be added one at a time. It is not possible to automatically add all the Extension fields at once to an OData Service and the same applies to all other related objects involved in KUT extensibility for example Web Services, Forms, Reports, etc.

 

Question 15:  Is it possible to fetch deleted records using OData?

Answer:  No. Once a record is deleted, the OData collection will not be able to fetch it.

 

Question 16: Your requirement is to update the field State - ContactCollection/ContactBusinessAddress/ContactBusinessPostalAddress/State using OData Service request.
But when you look at $metadata for c4codata service, the field has attribute sap:updatable="false"
Can we make these fields updatable?

Answer: Updating the State of ContactCollection/ContactBusinessAddress/ContactBusinessPostalAddress should be done via Account/AccountAddress-State.
To update the State code, you need to take the AccountID from ContactCollection and update via the Account/AccountAddress.
The State should not be updated via the BusinessAddress.

Question 17: Can you fetch records with a specific field using $Search filter in Standard Odata Service c4codata?

Answer: If the Enable Search option is checked in Standard c4codata service, only then you can use the required field for $Search filter.

Keywords

KBA , odata services , custom odata service , metadata , LOD-CRM-INT-API , OData API (C4C Only) , How To

Product

SAP Hybris Cloud for Customer all versions