This API provides a simple way to create a company with an otional contact and/or an optional opportunity and/or an optional activity — all in one step.
Please, note that it is for create only; queries and updates must be passed through the standard APIs.
Important! Please note, that — for security reasons — the QuickAdd API uses a different API key than the rest of the APIs!
The request format is:
https://app.forestcrm.hu/api/<format>/<QUICKADD API KEY>/quickadd
Request HTTP method: POST
format
can be either xml
or json
and only effects the format of the response.
Request parameters are:
match_by
: is any attribute (e.g. name) that has to match the given value for update (such as if it is "name" the company with the given name will be fetched and used (for update or for creating new entries for it); (optional, not used if not present)allow_update
: true or false; controls if an update is allowed or not (optional, defaults to false)company_id
is not required (discarded if present).match_by
: is any attribute (e.g. name) that has to match the given value for update (such as if it is "name" the contact with the given name will be fetched and used (for update); (optional, not used if not present)allow_update
: true or false; controls if an update is allowed or not (optional, defaults to false)company_id
is not required (discarded if present), andsalesrep_id
is optional and defaults to the ID of the first (enabled) userproduct_id
is optional and defaults to the ID of the first product (first by creation date)opportunity_date
is optional and defaults to 'today'company_id
and opportunity_id
are not required (discarded if present), andsalesrep_id
is optional and defaults to the ID of the first (enabled) userPlease note that entries are supposed to be new (unique) of their kind unless update is explicitly called for. Non-unique entities will result in 422 response codes.
POST https://app.forestcrm.hu/api/json/demo-qa/quickadd
Header:
Content-Type: application/json
Body:
{ "company": { "name": "Great Company", "salesrep_id": 2400, "address_street": "1 My Way", "address_city": "Smallville", "address_country": "AD", "tax_number": "A23445/2011", "category_ids": [2145, 2210] }, "contact": { "name": "John Little", "position": "Chairman", "phone": "(123) 123-4567", "note": "an old friend", "category_ids": [2190] }, "opportunity": { "name": "Selling Brilliance", "salesrep_id": 2400, "product_id": 34 }, "activity": { "description": "Registered via webform - First Call", "salesrep_id": 2400, "activity_type_id": 5, "scheduled_start": '2012-09-18' } }
If all entities could be created the response is of status code 200 and the body contains the the IDs of the entities created in the format passed in the URL (json
or xml
):
{ "company_id": 14930, "activity_id": 87555, "opportunity_id": 412, "contact_id": 17635 }
Errors are reported with a status code (422) and the response body contains the errors in the requested format.