cancel
Showing results for 
Search instead for 
Did you mean: 

C4C - How to Create a Lead or Opportunity with OData? Syntax error in body

Hello,
i want to create a Lead or Opportunity with OData over HTTP with an external tool.

1. I check the Opportunity Collection with the GET-Method and Basic Auth
URL: https://xxxxxxxx.crm.ondemand.com/sap/c4c/odata/v1/c4codata/OpportunityCollection?$format=json

2. I fetch a token with the GET-Method and Basic Auth
URL: https://xxxxxxxx.crm.ondemand.com/sap/c4c/odata/v1/c4codata/

3. I try to create an Opportunity with POST-Method, x-csrf-token and Basic Auth
URL: https://xxxxxxxx.crm.ondemand.com/sap/c4c/odata/v1/c4codata/OpportunityCollection

Body: ???

Does someone has a minimal code example?
Evertime i try to create an Opportunity, i get an error. Same with Lead.

Thanks and best regards
Lars

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

@Lars,

I'm having the same issue as well. Were you able to resolve this?

Thanks,

Tyler

Former Member
0 Kudos

Hi there,

I've the same issue doing a GET on the address: https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/pcmportal/DealRegistrationCollection/$count

getting this result:

<?xml version="1.0" encoding="utf-8"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
    <code>00145E5B1CC71ED0B4E35610A1174A95</code>
    <message xml:lang="en">The Data Services Request has been understood, but it is refused. User is succesfully authenticated. The request SHOULD NOT be repeated.</message>
</error>

Any Ideas?


Best Regards,

Daniel

0 Kudos

Hello again,
now i can create a ServiceTicket with OData in C4C.

In the next steps i want to create a lead. In an older question (https://archive.sap.com/discussions/message/16421946#16421946), i figured out that i have to use the "pcmportal" (URL: https://xxxxxxxx.crm.ondemand.com/sap/c4c/odata/v1/pcmportal/LeadCollection). It looks like an invisible odata service, because i don't see it in the admin area but can request the leadCollection.

My problem is, if i try to create the lead i get errors with this example (the mandatory field are "accountname of the customer", "name of the lead" and "ContactLastName"):

{  "Accountname": "Test",  "Name": "Testlead",  "ContactLastName": "Marketing Lead Person Last Name"}
<?xml version="1.0" encoding="utf-8"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">  <code>00145E5B1CC71EE0AB8B3A3B086F432E</code>  <message xml:lang="de">Der Data-Services-Request wird wegen inkorrekter Syntax nicht verstanden</message></error>

Any idea?

Thanks and best regards
Lars