SAP Knowledge Base Article - Public

2325562 - Frequently Asked Questions on C4C OData Services

Symptom

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

Environment

SAP Cloud for Customer

Resolution

1. How to access the SAP Cloud for Customer OData API of your tenant?

You can access the OData API of your tenant by following the URL pattern: https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi

 

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

You can access the metadata of the OData API of your tenant with the URL pattern: https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/$metadata

 

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

You can access the OData API reference for all the objects with the URL pattern: https://help.sap.com/viewer/u_collaboration_dev_help/7f5fa07e54e743c7b6f899e7fbe19598.html

 

4. Can OData v2 services be consumed in Cloud for Customer OData services?

You can use the same URL https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/ for accessing OData v2 in Cloud for Customer.

There are two different versioning in OData Services.

  1. OData Service Version
    • Supported versions are V1, V2
    • Eventhough the service is V2, in C4C the URL will still use V1
  2. Protocol Version
    • Versions V1 to V4
    • C4C supports V2.0 of the OData protocol (with some additional enhancements and a few limitations)

 

The system explicitly add the max count value as 1000 records if no other criteria is provided. To fetch more records add the $top parameter as shown below:

https://myXXXX.sapbydesign.com/sap/byd/odata/cust/v1/zcustomerinvoice_bw/CustomerInvoiceItemCollection?$top=1100

 

5. Is "Initially Received At" field available in standard OData service Cloud for Customer OData?

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

 

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

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

 

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

There is no OData API to retrieve Organizational Structure.

 

8. What are the different supported HTTP operations in OData?

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

 

9. What is the use of the Null checkbox when creating a Custom OData service?

The Null property defines a property as mandatory – if the property is nullable="false", it can be passed empty in the payload, which means it must always have a value for it. By flagging the Null checkbox, you allow a property to be nullable (i.e. it's not mandatory).

 

10. How to use $count filter with $filter while using GET function?

http://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/$count?$filter=AccountID eq 'XX'

 

11. Is it possible to Update/Delete/Export TextCollection Nodes via Data Workbench?

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

 

12. Is it possible to automatically add all the Extension fields at once to an OData Service?

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: web services, forms, reports, etc.

 

13. Is it possible to fetch deleted records using OData?

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

 

14. Your requirement is to update the field State (ContactCollection/ContactBusinessAddress/ContactBusinessPostalAddress/State) using an OData Service request, but when you look at the $metadata for the c4codataapi service, the field has attribute sap:updatable="false". Can we make these fields updatable?

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

 

15. Can you fetch records with a specific field using $search filter in standard OData service c4codataapi?

If the Enable Search option is checked in the standard c4codataapi service, only then you can use the required field for the $search filter.

 

16. Your requirement is to query Marketing Leads based on some filters using GET function in Postman / SoapUI. You want to know what is the Entity name which can be used to query the Marketing Leads.

Sales Leads is Obsolete in the SAP Cloud for Customer system. For Sales Leads in the Sales work center, the entity is Lead. There is a new entity for Marketing Leads which is LeanLead. For Leads in Marketing work center, refer to entity set LeanLeadCollection.

 

17. Can you send an XML POST Request payload using OData?

Yes. Just as Json, XML payload can be sent.

 

18. Which web service is used by OData (Open Data Protocol)?

OData uses REST based web service, synchronous execution. For more details, please refer to the below link:

https://blogs.sap.com/2016/07/14/comparing-c4c-integration-methods-a2a-a2x-odata-for-high-volume-scenarios/

 

19. Is it possible to use a Technical User for C4C OData API?

You can refer to below blog for more information:
https://blogs.sap.com/2019/12/03/integration-user-for-odata-services-in-sap-cloud-for-customer/

 

20. Is it possible for a user to work with an OData service without having the access rights for the respective work center view (e.g. using ProductCollection without having access to the Products > Product Administration work center view)?

No. This would result in error "403 - Unauthorized".

 

21. Unable to find the C4CODATAAPI service when trying to edit and extend the KUT/PDI extension field.

The C4CODATAAPI is a combination of multiple services. You need to add it to individual services – e.g. customer, contact, employeeanduser – in the OData Services facet and it will reflect in C4CODATAAPI.

Note: While extending KUT fields you need to select the respective Service Name for the Object Name. For example the service for BO, Service Request is Ticket. Refer to the attachment for the List of Service details per BO.

 

22. What are the impacts of the deprecation of OData v1 and A2X web services in C4C?

Details for this are available in the blog below:

https://blogs.sap.com/2018/08/21/introducing-sap-cloud-for-customer-odata-api-v2/

  1. Custom services will not be impacted by this change. A2A Web Services are still being supported and we don’t have any plans to deprecate them anytime soon.
  2. OData v1 (REST) or A2X (SOAP) services are meant to be used to integrate with non-SAP systems with or without middleware. After 2020, only OData v2 (REST) will be active to be used for such integrations with non-SAP systems where SAP doesn't provide standard integration. SAP provides standard integration between C4C & ERP/S4/CRM via middlewares CPI or PI, and all these services are A2A / SOAP services which will remain unchanged

 

23. How to set up C4C OData notification to monitor C4C Opportunity change in CRM system?

Details on how to set up the C4C OData notification are available in the blog below:

https://blogs.sap.com/2017/08/05/leverage-c4c-odata-notification-to-monitor-c4c-opportunity-change-in-crm-system/

The consuming structure for C4C OData notifications contains four fields and documentation for the same is available in the below mentioned blog:

  • BusinessObject
  • BusinessObjectId
  • ODataServiceEndpoint
  • Event

Blog: https://help.sap.com/viewer/DRAFT/cea15f900ca04c4faa35d3044577fe27/1708/en-US/2432c1fb294b4ef59efb8b37a7e7c6eb.html

 

24. Can ETag be used for filtering OData entities?

Yes, filtering the entities using ETag is permitted using OData Services.

 

25. Can I use the ETag property to filter for the ChangedOn field time stamp of an entity?

Although the ETag property can be used for filtering, it should only be considered for concurrency control and not for filtering of the ChangedOn field time stamp on any entity, as entities may be based on more than one Business Object at the same time and because of that, the ETag result may differ from the ChangedOn time stamp in the UI.

 

26. Can you add obsolete customers to Target Group via OData service?

No, you should first activate the Account back and the add it to the Target Group.

 

27. Does C4C support OData v3 or v4 versions?

Only v1 and v2 are supported in C4C OData services.

 

28. Which OData Service helps to retrieve Employee ID?

Service LoggedInUserInfo with a functional import IdentityGetLoggedInUserInfo

 

29. What is the OData Service for Price Lists?

The OData Service for Price List is salespricelist. To upload Price List, you may use the Data Workbench object Internal Price/Discount List and to upload its items, you may use the Data Workbench object Internal Price/Discount List Items.

 

30. How to access OData Monitor for a customer tenant?

OData Monitor is already released to customer since the 1811 upgrade.

Help document:
https://help.sap.com/viewer/1364b70b9cbb417ea5e2d80e966d4f49/1911/en-US/b864250a4dd04305882ae1dce1d26955.html

To Launch OData Monitor: Logon to SAP Cloud for Customer
    a. Go to Administrator workcenter
    b. Select General Settings
    c. Under System Administration you can see the link for OData API Monitor

 

31. Is it possible to re-enable OData notifications (update/creation)?

For new scenarios, we recommend the customer to use the new Event Notification feature. For existing scenarios, we can support the customer via an case.

The UIs may look the same, but the deprecated functionality has some issues, which is which why use of the new Event Notification is recommended.

 

32. Is it possible to connect SAP Cloud for Customer with external systems directly through OData Services without any middleware like HCI/CPI/PI and using only basic authentication? Does it have any internal policy violation? 

There is no restriction on using basic authentication. However, we strongly recommend certificate based authentication or OAuth (as per the need) as these mechanisms are much more robust and secure.

With basic authentication, issues such as password expiry, wrong password or password changed in C4C by mistake can lead to production down situations. Such situations can largely be avoided with other authentication mechanisms, as mentioned.

 

33. Is it possible to create a URL to create a "child" ticket using OData service ServiceRequestBusinessTransactionDocumentReferenceCollection?

The collection ServiceRequestBusinessTransactionDocumentReferenceCollection cannot be used for PUT and PATCH methods.

Please refer to guide: https://myXXXXXX.crm.ondemand.com/sap/bc/mdrs/cdo?type=UI_KTD_R&objname=ODATA_TICKET_10

HTTP MethodOperationURI
GET Request ServiceRequestBusinessTransactionDocumentReference Data

https://myXXXXXX.crm.ondemand.com/ServiceRequestBusinessTransactionDocumentReferenceCollection

POST Operation not supported for this Entity Type n/a
PATCH Operation not supported for this Entity Type n/a
DELETE Delete ServiceRequestBusinessTransactionDocumentReference Data

https://myXXXXXX.crm.ondemand.com/ServiceRequestBusinessTransactionDocumentReferenceCollection('ObjectID')

Workaround for above requirement is to make use of the MainTicketID entity. You can refer to the below property in standard odata service:

sap/c4c/odata/v1/ticket/$metadata
<Property Name="MainTicketID" Type="Edm.String" Nullable="true" MaxLength="35" FixedLength="true" sap:creatable="true" sap:updatable="true" sap:filterable="true" sap:label="Main Ticket"/>

 

34. Why is Country Code mandatory when creating an Employee with Odata service Employee whereas it is not required when creating from UI?

Country code was set to mandatory intentionally in the EmployeeAndUser odata service. Reasons are as as listed below:

1) Country Code was already mandatory in the old Migration workbench migration tool.
2) When creating an identity, it makes sense to have an employee workplace address
3) During identity creation (happens when creating internal employee) determination of basic settings (.e.g. logon language, time zone...) heavily depends on the country

Having a meaningful country allows better defaulting of those identity basic settings.

 

35. Is it possible to have ID mapping between C4C Internal ID and External ID in OData-based integrations?

Currently, there is no support of ID Mapping between C4C Internal ID and External ID in OData.

 

36. How to navigate to the Attachment Folder for the Object Leads?

Attachment folder can be navigated following the below URL:

HTTP MethodOperationURI
GET Request LeadAttachmentFolder Entity Data https://myXXXXXX.crm.ondemand.com/LeadCollection('ParentObjectID')/LeadAttachmentFolder
POST Create New LeadAttachmentFolder https://myXXXXXX.crm.ondemand.com/LeadCollection('ParentObjectID')/LeadAttachmentFolder
PATCH Update LeadAttachmentFolder Data https://myXXXXXX.crm.ondemand.com/LeadAttachmentFolderCollection('ObjectID')
DELETE Delete LeadAttachmentFolder Data https://myXXXXXX.crm.ondemand.com/LeadAttachmentFolderCollection('ObjectID')

 

36. How to use filter on a child object which cannot be directly accessed?

You have to filter on the parent object and then expand to the child object as in the URL example below, where OpportunityCollection is the parent object and OpportunityAttachmentFolder is the child object.

https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/OpportunityCollection?$filter=ID eq '27534'&$expand=OpportunityAttachmentFolder

 

37. How to get the involved parties information on the Registered Products based on Role Code?

https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/RegisteredProductPartyInformationCollection?$filter=RegisteredProductID eq '<ID>' and RoleCode eq '<RoleCode>'

 

38. Will the SAP Cloud for Customer OData API v1 stop working properly?

The SAP Cloud for Customer OData API v1 is set as "Obsolete" since February 2020. However, it will continue to work and be supported in existing implementations, though no enhancement beyond bug fixes is expected for it, and it is not available for new projects.

 

39. Which service is used to request Identity Data of currently logged user?

GET operation not supported for entity type LoggedInUserInfoCollection. Use function import IdentityGetLoggedInUserInfo to request Identity Data of currently logged in user.

https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/IdentityGetLoggedInUserInfo
(where XXXXXX represents the tenant)

For documentation, refer SAP Cloud for Customer OData API v2 Reference in the link:
https://help.sap.com/doc/d0f9ba822c08405da7d88174b304df84/CLOUD/en-US/index.html#/topic/LoggedInUserInfo

 

40. Why does the complete request fail when there is an incorrect request among the multiple requests sent within a payload using the $batch operation?

In a $batch operation, if one request fails, all the other requests fail simultaneously. This is the expected system behavior.

 

41. What is the validity of a CSRF token?

CSRF token validity is linked to the validity of the security session. Usually, the security session is valid for 3600s (i.e. 60 mins) and if any successful call using the same session cookie is done within this duration, the session expiry is extended by another 60 minutes.

 

42. Unable to find Opportunity field in SalesQuoteCollection.

Currently, the field Opportunity is not a part of SalesQuoteCollection. Hence it can't be accessed via OData or Data Workbench.

 

43. Is there any plan to support logical OR in different properties?

Currently, logical OR only works for the same property and there is no plan to support logical OR in different properties.

 

44. Timeline comments are showing incorrect format in C4C Ticket after using OData API.

Timeline expects the text to be a Rich Text Content. This means when sending the formatted text for Timeline, you would need to pass break tags (<br>), instead of \n.

 

45. How long are the logs retained in OData API Monitor?

By default, it is 7 days. From 2011 release onwards, it is extended to 15 days.

 

46. Does C4C OData support single sign-on (SSO)?

Yes, by using the URL https://myXXXXXX.crm.ondemand.com/sap/c4c/odata-sso/v1/c4codataapi (where XXXXXX represents your tenant)

For individual OData Services (such as, for example, ProductCollection), the URL should be https://myXXXXXX.crm.ondemand.com/sap/c4c/odata-sso/v1/product.

 

47. Is Cross-Origin Resource Sharing (CORS) Enabled for OData Services?

Currently CORS is not supported for OData Services API.

 

48. The GET call does not return a x-CSRF-token for the technical user in Postman, SOAP UI, CPI or in any external integration.

The CSRF token is not returned for Technical user. Technical user should be used for server-to-server integration and in this case, there is no need for CSRF token. OData calls made with technical user will not return a CSRF token and POST calls work without CSRF token for such users and is also not required for PUT/PATCH/DELETE.

 

49. Why is OData API Monitor still capturing calls when deactivated?

All error calls are logged defaultly. The Monitor is not required to be actived to log error calls.

 

50. Why multi-value list fields are only displayed with code in the collections?

Currently, the OData framework supports only the display of code type, meaning code description will not be displayed.

  

51. Why does the result is blank when you fetch OpportunityTextCollectionCollection?

This is an expected system behavior. If there is no data, there will not be any message from Odata Services, it will only be blank data.

For External Integration Scenarios, you may handle the blank values in middleware or client side.

52. You have a requirement to create a Custom node within a Standard Object which you have extended via SDK but it is not seen as a separate node in Data workbench Object Collection.

This is because all nodes having the static cardinality of 0..1 or 1..1 are treated as part of the same node(i.e. Parent node) and no new entity will be created in this case. Only nodes having a cardinality of 0..n and 1..n will have new entity types/sets created.

53. Is there any specific limit on length of query?

• maxQueryStringLength

• maxRequestLength

• maxUrlLength

The limit on the server for the total URL (path + query string) is 8448 Bytes (Characters). if the lenght of the URL exceeds this limit then you will get "Bad Request" - "Your browser sent a request that this server could not understand" as response from the server

54. What is the optimum size for Pagination, when you are making Odata Calls from CPI to C4C?

As per the guideline, for optimum performance on GET calls,

(without expand ) - Default count is 1000 records and the max recommendation is 3000 for optimal performance
(with expand ) - Default count is 100 records and the max recommendation is 1000 for optimal performance

55. You are unable to customize pagination size in Odata URL. The combination of $skip=1&$top=1 does not produce successive URL.

Server side pagination: The Pagination in Odata Servcies is by default 1000 after which yon can find the URL for next set of 1000 records.

Client side pagination: You can retrieve required information using combination of $skip=1&$top=1 URL. This will not provide next URL after the reponse. 

This is designed behavior.

Reference : GITHUB

Keywords

OData FAQ, Frequently Asked Questions, OData, FAQ, FAQ ODATA , KBA , c4c api issue call , odata faq , faq odata , odata services , custom odata service , metadata , LOD-CRM-INT-API , OData API (C4C Only) , How To

Product

SAP Cloud for Customer add-ins all versions ; SAP Cloud for Customer core applications all versions

Attachments

c4codataapi+Entity+types+for+KUT+extension.xlsx