cancel
Showing results for 
Search instead for 
Did you mean: 

Sales Cloud V2 API - Error Create Leads

SCHNEIDERT
Active Contributor

Hi Experts,

I'm able to use Postman to do a GET request to our Sales Cloud V2 system to query all of the existing leads (endpoint /sap/c4c/api/v1/lead-service/leads)

According to the documentation on Business Accelerator Hub it should also be possible to create Leads using POST method with the same endpoint.

When I do, I get an error message saying "Lead unsupported scenario":

I also fetched a "x-sap-crm-token" as described here, so that did not cause the issue.

Best Regards

Tobias

View Entire Topic
AlanChen
Advisor
Advisor

Hi Tobias,

Can you share the payload?

SCHNEIDERT
Active Contributor
0 Kudos

Hi alan.chen03,

I only posted three fields to see if it works:

{ "name": "Postman_Lead", "internalStatus": "OPEN", "status": "1"

}

Unfortunately I cannot find any documentation if there are mandatory fields or something like that. I only know the V1-documentation.

BR Tobias

AlanChen
Advisor
Advisor
0 Kudos

Hi Tobias,

I tested the creation via Postman from my side. Without the account information, I got the same error "Lead unsupported scenario".

After I add other fields in the request body according to the documentation. I created it successfully.

It means that the other fields like account & owner can be mandatory.

PS: Creating the Lead only filled in the name, I got the same error on the UI screen. Check the screenshot attached.

Please follow the steps below to retry the creation via Postman from your side.

  1. Get one of the leads via the API endpoint/sap/c4c/api/v1/lead-service/leads?$top=1
  2. Create a Lead via the link provided in the documentation. Note that, keep the intact body provided in the doc
  3. You can fill in the body with the information fetched in step 1
  4. Add the header x-sap-crm-token
  5. Send the request

Feel free to contact me if any further queries.

Alan

SCHNEIDERT
Active Contributor
0 Kudos

Hi alan.chen03,

thanks so much for your support! Using contactId and accountId it worked and I was able to create a lead.

So, but that means it is only possible to create leads for existing customers (accounts and contacts)? What about new/unknown customers (e.g. from a trade fair). In V1 we were still able to create leads for them (with name as a free text) and convert them to contact and account later after they have been qualified.

Kind Regards

Tobias

AlanChen
Advisor
Advisor
0 Kudos

Hi Tobias,

Actually, we can!

Please use the payload below for unknown customers. If you want to add other fields, please refer to the aforementioned API endpoint/sap/c4c/api/v1/lead-service/leads?$top=1.

{
"name": "POST_Lead 5",
"isDraftMode": false,
"internalStatus": "OPEN",
"status": "1",
"account": {
"firstLineName": "job"
},
"contacts": [
{
"familyName": "steve",
"formattedName": "steve",
"isPrimary": true
}
]
}
MarcoKj
Explorer
0 Kudos

Hi Tobias
Did you manage to see the unknown lead in sales cloud by using the payload? When I try I get the 201, however, I cannot see neither the lead nor contact.

Regards

Marco

MarcoKj
Explorer
0 Kudos

Got it to work, no worries!