Skip to content

Commit 33386ba

Browse files
committed
Updated contact,company and deal typo and error
Modified contact,company and deal. Added partial update for contact,company and added one api for deal
1 parent 5e7167c commit 33386ba

File tree

1 file changed

+57
-49
lines changed

1 file changed

+57
-49
lines changed

README.md

+57-49
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ PHP Client to access Agile functionality
33

44
#Intro
55

6-
1. Fill in your **AGILE_DOMAIN**, **AGILE_USER_EMAIL**, **AGILE_REST_API_KEY** in [**curlwrap_v2.php**](https://github.com/ghanraut/php-api/blob/master/CurlLib/curlwrap_v2.php).
6+
1. Fill in your **AGILE_DOMAIN**, **AGILE_USER_EMAIL**, **AGILE_REST_API_KEY** in [**curlwrap_v2.php**](https://github.com/agilecrm/php-api/blob/master/CurlLib/curlwrap_v2.php).
77

8-
2. Copy and paste the source / include the [**curlwrap_v2.php**](https://github.com/ghanraut/php-api/blob/master/CurlLib/curlwrap_v2.php) in your php code.
8+
2. Copy and paste the source / include the [**curlwrap_v2.php**](https://github.com/agilecrm/php-api/blob/master/CurlLib/curlwrap_v2.php) in your php code.
99

1010
3. You need to provide 4 paramaters to the curl_wrap function. They are **$entity**, **$data**, **$method**, **$content-type**.
1111

12-
- **$entity** should be one of *"contacts/{id}", "contacts", "opportunity/{id}", "opportunity", "notes", "contacts/{contact_id}/notes", "contacts/{contact_id}/notes/{note_id}", "tasks/{id}", "tasks", "events", "events/{id}", "milestone/pipelines", "milestone/pipelines/{id}", "tags", "contacts/search/email/{email}"* depending on requirement.
12+
- **$entity** should be one of *"contacts/{id}", "contacts","contacts/edit-properties","contacts/edit/add-star","contacts/edit/lead-score", "opportunity/{id}", "opportunity", "notes", "contacts/{contact_id}/notes", "contacts/{contact_id}/notes/{note_id}", "tasks/{id}", "tasks", "events", "events/{id}", "milestone/pipelines", "milestone/pipelines/{id}", "tags", "contacts/search/email/{email}"* depending on requirement.
1313

1414
- **$data** must be stringified JSON.
1515

@@ -55,7 +55,7 @@ $data = json_encode($data);
5555

5656
application/json.
5757

58-
application/x-www-form-urlencoded (To valid form type data)
58+
application/x-www-form-urlencoded
5959

6060
#Usage
6161

@@ -188,14 +188,14 @@ $contact_json = json_encode($contact_json);
188188
curl_wrap("contacts", $contact_json, "PUT", "application/json");
189189
```
190190

191-
#### 1.5 Update properties of a contact (Partial update)
191+
#### 1.5 Update properties of a contact (partial update)
192192

193-
- **Note** Send only requierd properties data to update contact. No need to send all data of a contact.
193+
- **Note** Send only required properties data to update contact. No need to send all data of a contact.
194194

195195
```javascript
196196

197197
$contact_json = array(
198-
"id"=>5722721933590528, //It is mandatory filed. Id of contact
198+
"id"=>"5722721933590528", //It is mandatory filed. Id of contact
199199
"properties"=>array(
200200
array(
201201
"name"=>"first_name",
@@ -224,33 +224,30 @@ $contact_json = json_encode($contact_json);
224224
curl_wrap("contacts/edit-properties", $contact_json, "PUT", "application/json");
225225
```
226226

227-
#### 1.6 Edit star value
227+
#### 1.6 Update star value
228228

229229
```javascript
230230

231231
$contact_json = array(
232-
"id"=>5722721933590528, //It is mandatory filed. Id of contact
232+
"id"=>"5722721933590528", //It is mandatory filed. Id of contact
233233
"star_value"=>"5"
234234
);
235235

236236
$contact_json = json_encode($contact_json);
237237
curl_wrap("contacts/add-star", $contact_json, "PUT", "application/json");
238238
```
239239

240-
#### 1.7 Add Score to a Contact using Email-ID
240+
#### 1.7 Update lead score
241241

242242
```javascript
243243

244-
$fields = array(
245-
'email' => urlencode("haka@gmail.com"),
246-
'score' => urlencode("30")
247-
);
248-
$fields_string = '';
249-
foreach ($fields as $key => $value) {
250-
$fields_string .= $key . '=' . $value . '&';
251-
}
244+
$contact_json = array(
245+
"id" => "5722721933590528", //It is mandatory filed. Id of contact
246+
"lead_score" => "5"
247+
);
252248

253-
curl_wrap("contacts/add-score", rtrim($fields_string, '&'), "POST", "application/x-www-form-urlencoded");
249+
$contact_json = json_encode($contact_json);
250+
curl_wrap("contacts/edit/lead-score", $contact_json, "PUT", "application/json");
254251
```
255252

256253
#### 1.8 Adding Tags to a contact based on Email
@@ -325,7 +322,7 @@ curl_wrap("contacts/5695414665740288", null, "DELETE", "application/json")
325322

326323
```javascript
327324
$company_json = array(
328-
"id"=>5695414665740288,
325+
"id"=>"5695414665740288",
329326
"type"=>"COMPANY",
330327
"properties"=>array(
331328
array(
@@ -345,6 +342,44 @@ $company_json = json_encode($company_json);
345342
curl_wrap("contacts", $company_json, "PUT", "application/json");
346343
```
347344

345+
#### 2.5 Update properties of a company (partial update)
346+
347+
- **Note** Send only required properties data to update company. No need to send all data of a company.
348+
349+
```javascript
350+
$company_json = array(
351+
"id"=>"5695414665740288", //It is mandatory filed. Id of company
352+
"properties"=>array(
353+
array(
354+
"name"=>"name",
355+
"value"=>"test company",
356+
"type"=>"SYSTEM"
357+
),
358+
array(
359+
"name"=>"url",
360+
"value"=>"https://www.test-company.org",
361+
"type"=>"SYSTEM"
362+
)
363+
)
364+
);
365+
366+
$company_json = json_encode($company_json);
367+
curl_wrap("contacts/edit-properties", $company_json, "PUT", "application/json");
368+
```
369+
370+
#### 2.6 Update star value of a company
371+
372+
```javascript
373+
374+
$contact_json = array(
375+
"id"=>5722721933590528, //It is mandatory filed. Id of a company
376+
"star_value"=>"5"
377+
);
378+
379+
$contact_json = json_encode($contact_json);
380+
curl_wrap("contacts/add-star", $contact_json, "PUT", "application/json");
381+
```
382+
348383
# 3. Deal (Opportunity)
349384

350385
- **Note** Milestone name is case sensitive. It should be exactly as in your Agile CRM
@@ -369,7 +404,7 @@ $opportunity_json = array(
369404
),
370405
"probability"=>50,
371406
"close_date"=>1414317504,
372-
"contact_ids"=>array(5722721933590528)
407+
"contact_ids"=>array("5641841626054656", "5756422495141888")
373408
);
374409

375410
$opportunity_json = json_encode($opportunity_json);
@@ -417,34 +452,7 @@ $opportunity_json = json_encode($opportunity_json);
417452
curl_wrap("opportunity", $opportunity_json, "PUT", "application/json");
418453
```
419454

420-
#### 3.5 To update deal (Partial update)
421-
422-
```javascript
423-
$opportunity_json = array(
424-
"id" => "5202889022636032", //It is mandatory filed. Id of deal
425-
"expected_value" => 1000,
426-
"milestone" => "Open",
427-
"pipeline_id" => "5502889022636568",
428-
"custom_data" => array(
429-
array(
430-
"name" => "dataone",
431-
"value" => "xyz"
432-
),
433-
array(
434-
"name" => "datatwo",
435-
"value" => "abc"
436-
)
437-
),
438-
"probability" => 50,
439-
"close_date" => 1414317504,
440-
"contact_ids" => array("5641841626054656", "5756422495141888")
441-
);
442-
443-
$opportunity_json = json_encode($opportunity_json);
444-
curl_wrap("opportunity/partial-update", $opportunity_json, "PUT", "application/json");
445-
```
446-
447-
#### 3.6 Get deals related to specific contact by contact id
455+
#### 3.5 Get deals related to specific contact by contact id
448456

449457
```javascript
450458
curl_wrap("contacts/5739083074633728/deals", null, "GET", "application/json");

0 commit comments

Comments
 (0)