Listing deals
GET /deals.xml
Returns a paginated list of deals.
Parameters:
Parameter | Type | Description |
---|---|---|
project_id | integer/string | get deals from the project with the given id |
assigned_to_id | integer | get deals assigned to the user with the given id |
status_id | integer | get deals with the given status id |
search | string | get deals with the given search string |
Examples:
GET /deals.xml GET /deals.xml?project_id=2 GET /deals.xml?assigned_to_id=1&status_id=1 GET /deals.xml?search=tom Paging example: GET /deals.xml?project_id=testproject&page=1 GET /deals.xml?project_id=testproject&page=2
Response:
<deals total_count="5" offset="0" limit="25" type="array">
<deal>
<id>13</id>
<price>10000</price>
<currency>USD</currency>
<price_type/>
<duration/>
<probability/>
<due_date/>
<background>
1C:Enterprise 8 system of programs is intended for automation of everyday enterprise activities: various business tasks of economic and management activity, such as management accounting, business accounting, HR management, CRM, SRM, MRP, MRP, etc.
</background>
<project id="4" name="Redmine CRM plugin demo"/>
<status id="1" name="New"/>
<category id="3" name="Integration"/>
<author id="4" name="Smith Paul"/>
<contact id="7" name="LLC "Selection""/>
<assigned_to id="4" name="Smith Paul"/>
<related_contacts type="array">
<contact id="46" name="Ballmer, Steven"/>
<contact id="44" name="Gates, Bill"/>
</related_contacts>
<custom_fields type="array">
<custom_field id="14" name="Deal custom field">
<value/>
</custom_field>
</custom_fields>
<created_on>2011-09-30T08:30:06Z</created_on>
<updated_on>2011-11-14T21:18:18Z</updated_on>
</deal>
<deal>
...
</deal>
</deals>
Showing a deal
GET /deals/[id].xml
Examples:
GET /deals/2.xml GET /deals/2.json
Creating a deal
POST /deals.[format]
Parameters:
deal
- A hash of the deal attributes:project_id
name
contact_id
- Company name stringprice
currency
probability
due_date
background
status_id
category_id
assigned_to_id
- ID of the user to assign the deal to (currently no mechanism to assign by name)custom_fields
- See Custom fields
Examples:
POST /deals.xml <?xml version="1.0"?> <deal> <project_id>1</project_id> <name>New deal</name> <contact_id>1</contact_id> </deal>
POST /deals.json { "deal": { "project_id": 1, "name": "New deal", "contact_id": 1 } }
Curl examples
Update deal
curl -v -H “Accept: application/json” -H "Content-Type: application/json" -X PUT http://localhost:3000/deals/1 -u admin:admin -d "{\"deal\": {\"name\":\"Updated via API deal\"}}"
Create deal
curl -v -H "Content-Type: application/xml" -X POST -d "<deal><name>Created via API deal</name><contact_id>1</contact_id><project_id>support</project_id></deal>" -u admin:admin http://localhost:3000/deals.xml