我尝试在自定义模块和联系人之间创建关系,但是在创建之后(响应是{"已删除":0,"已创建":1, "失败":0})我也没有在应用程序面板和数据库关系表中发现(仅手动创建一个记录)。我的错在哪里?
示例代码:
String sessioneID = "xxxxx";
String contactId = "yyyyyy";
Map<String, String> nameValueList = new LinkedHashMap<String, String>();
List<String> relatedIds = new ArrayList<String>();
relatedIds.add(customId);
Map<String, Object> request = new LinkedHashMap<String, Object>();
request.put("session", sessioneID);
request.put("module_name", "Contacts");
request.put("module_id", contactId);
request.put("link_field_name", "custom_contacts");
request.put("related_ids", relatedIds);
request.put("deleted", "0");
List<NameValuePair> formParams = new ArrayList<NameValuePair>();
formParams.add(new BasicNameValuePair("method", "set_relationships"));
formParams.add(new BasicNameValuePair("input_type", "JSON"));
formParams.add(new BasicNameValuePair("response_type", "JSON"));
formParams.add(new BasicNameValuePair("rest_data", JSONObject.toJSONString(request)));
HttpPost httpPost = new HttpPost("http://kkkk.com/rest.php");
httpPost.setEntity(new UrlEncodedFormEntity(formParams));
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpResponse execute = httpClient.execute(httpPost);
由于