0

大家好,我一直在使用salesforce Rest Api进行日志记录,现在我想使用登录调用返回给我的访问令牌来创建潜在客户但是,当我尝试使用访问令牌创建潜在客户时,它并没有被创建,并且我得到的响应不包含Lead id

我已经坚持了好几天了,经过大量谷歌搜索后,我找不到答案。

我想在 android 中实现这个功能,但现在我正在使用 Google chrome Plugin Advance Rest Client 进行测试。

创建潜在客户 URL--> https://na14.salesforce.com/services/data/v21.0/sobjects/Lead

标题 -->

Authorization: OAuth 00Di0000000Y4be!AR8AQHCnNzqTM1tItXuwTRdXfRmn7JbZlneSA3pMjmrw.5aZqz0JecaTj2coEXHbEi61iQEhHWg0lTc0BZ0k4U_1BccJvFaZ

有效载荷或正文 -->

{"Phone":"789452",    

"Company":"Test Company",   

"Fax":"1238356"
,"LastName":"Micheal"

}

内容类型: application/json

我正在使用发布请求。我得到的回应是

    {
objectDescribe: {
name: "Lead"
label: "Lead"
keyPrefix: "00Q"
custom: false
labelPlural: "Leads"
layoutable: true
activateable: false
urls: {
sobject: "/services/data/v21.0/sobjects/Lead"
describe: "/services/data/v21.0/sobjects/Lead/describe"
rowTemplate: "/services/data/v21.0/sobjects/Lead/{ID}"
}-
searchable: true
deprecatedAndHidden: false
createable: true
updateable: true
deletable: true
customSetting: false
feedEnabled: true
mergeable: true
queryable: true
replicateable: true
retrieveable: true
undeletable: true
triggerable: true
}-
recentItems: [8]
0:  {
attributes: {
type: "Lead"
url: "/services/data/v21.0/sobjects/Lead/--SomeId---"
}-
Id: "--SomeId---"
Name: "Luna, Wilredo"
}-
1:  {
attributes: {
type: "Lead"
url: "/services/data/v21.0/sobjects/Lead/--SomeId---"
}-
Id: "--SomeId---"
Name: "Rannga, Lite"
}-
2:  {
attributes: {
type: "Lead"
url: "/services/data/v21.0/sobjects/Lead/--SomeId---"
}-
Id: "--SomeId---"
Name: "Sith, Aro"
}-
3:  {
attributes: {
type: "Lead"
url: "/services/data/v21.0/sobjects/Lead/--SomeId---"
}-
Id: "--SomeId---"
Name: "Smith, Aberen"
}-
4:  {
attributes: {
type: "Lead"
url: "/services/data/v21.0/sobjects/Lead/--SomeId---"
}-
Id: "--SomeId---"
Name: "RANAHAN, MICHAEL"
}-
5:  {
attributes: {
type: "Lead"
url: "/services/data/v21.0/sobjects/Lead/--SomeId---"
}-
Id: "--SomeId---"
Name: "RABADI, RAED"
}-
6:  {
attributes: {
type: "Lead"
url: "/services/data/v21.0/sobjects/Lead/--SomeId---"
}-
Id: "--SomeId---"
Name: "A., Christopher"
}-
7:  {
attributes: {
type: "Lead"
url: "/services/data/v21.0/sobjects/Lead/--SomeId---"
}-
Id: "--SomeId---"
Name: "Ratnayake, Sam"
}-
-
}
4

1 回答 1

1

我已经解决了这个问题。我正在发布答案,以便它可以帮助那些面临同样问题的人

我正在做的是我正在发送此屏幕截图中描述的登录请求。我得到了以下回应。

{"id":"https://login.salesforce.com/id/00Di00000Y4EAC/005i0000000kAAA",
    "issued_at":"13756912686",
    "instance_url":"https://company.my.salesforce.com",
    "signature":"UAcaAbSj7vClbc/yAURGkT/7Hkjq6sllhcGvASs=",
 "access_token":"00Di0000000Y4befdjBiSvJ7RfW1s1fmUsLCf6UAQCgtmD.biS7T5rSOxyvtniyLeLN"}

刚刚从

https://na14.salesforce.com/services/data/v21.0/sobjects/Lead

格式: instance_url+/services/data/v21.0/sobjects/Lead/

实际网址: https ://company.my.salesforce.com/services/data/v21.0/sobjects/Lead/

现在一切正常。问题是我必须将instance_url前导 Url连接起来。我不认为我可以创建潜在客户,除非我知道 API 调用应该发送到的实例。

Salesforce Rest API 文档中所述

instance_url:标识应向其发送 API 调用的 Salesforce 实例

于 2013-08-04T11:15:15.820 回答