salesforce php,php – JSON将记录插入Salesforce

嗨,这是一个很长的镜头,但我试图通过

PHP(Codeigniter框架)的API调用将数据插入到销售人员对象中.我使用CURL协议并且没有插入记录,但我也没有收到任何错误消息.

我的所有连接参数都是正确的,我成功检索记录/更新记录,但我无法插入.

public function insert_record($object_name, $field_list=FALSE) {

$request = trim($this->instance_url).

'/services/data/'.$this->api_version.'/sobjects/'.trim($object_name).'/';

return $this->execute_request($request, FALSE , json_encode($field_list));

}

函数调用:

$record_to_insert = array("Name__c" =>

"Ricky Hernadez", "Status__c" => "Single",

"Description__c" => "This is a test");

$this->data['results'] =$results = $this->salesforce->insert_record("Online_Participant__c", $record_to_insert);

这是$results数组包含的内容:

object(stdClass)#24 (2) {

["recentItems"]=>

array(1) {

[0]=>

object(stdClass)#25 (3) {

["attributes"]=>

object(stdClass)#26 (2) {

["type"]=>

string(21) "Online_Participant__c"

["url"]=>

string(70) "/services/data/v22.0/sobjects/Online_Participant__c/a0bi00000027HGbAAM"

}

["Id"]=>

string(18) "a0bi00000027HGbAAM"

["Name"]=>

string(6) "OP0004"

}

}

["objectDescribe"]=>

object(stdClass)#27 (21) {

["name"]=>

string(21) "Online_Participant__c"

["label"]=>

string(18) "Online Participant"

["keyPrefix"]=>

string(3) "a0b"

["labelPlural"]=>

string(19) "Online Participants"

["custom"]=>

bool(true)

["layoutable"]=>

bool(true)

["activateable"]=>

bool(false)

["urls"]=>

object(stdClass)#28 (3) {

["sobject"]=>

string(51) "/services/data/v22.0/sobjects/Online_Participant__c"

["describe"]=>

string(60) "/services/data/v22.0/sobjects/Online_Participant__c/describe"

["rowTemplate"]=>

string(56) "/services/data/v22.0/sobjects/Online_Participant__c/{ID}"

}

["searchable"]=>

bool(true)

["deprecatedAndHidden"]=>

bool(false)

["createable"]=>

bool(true)

["updateable"]=>

bool(true)

["deletable"]=>

bool(true)

["customSetting"]=>

bool(false)

["feedEnabled"]=>

bool(false)

["mergeable"]=>

bool(false)

["queryable"]=>

bool(true)

["replicateable"]=>

bool(true)

["retrieveable"]=>

bool(true)

["undeletable"]=>

bool(true)

["triggerable"]=>

bool(true)

}

}

最佳答案 您似乎正在发出GET请求,您需要使用POST来创建新记录.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值