plumbing api v 2.8

API APRO CRM

Basic Features
This API provides the access to the CRM and Intranet data. Requests should be sent to: http://domainname.crma.pro:81/sharedapi/[object_type]/[subtype], where domainname should be replaced by your CRM domain name.
Any request should comprise an access key of 32 characters. For example: {
  apikey: /* 32 characters key */,
  params: /* associative array of parameters */
}
The response is available in JSON format. A correct request will render the following response: {
  status: "success",
  data: /* object */
}
An error request will render the following response: {
  status: "fail",
  message: /* error code */
}
Error codes:
  • ACCESS_DENY - access denied
  • LIMIT_EXCEEDED - requests limit exceeded
  • BAD_REQUEST - invalid object request
  • BAD_PARAMS - invalid request parameters

Attention!

Default limits are as follows:
  • - the number of requests must not exceed 200 per hour (can be extended upon request);
  • - the number of array elements in a request, including the inclosed ones, must not exceed 1000.

Attention!

In case of connection errors, try to use port 80 as an alternative.
You can download the PHP library with sample scripts from here.
Data format
radio Yes(1) No(0) selection
select Single choice
multiselect Multiple choice
date Date 2014-03-14
datetime Date 2014-03-14 21:34:05
time Time 21:34:05
integer Integer
decimal Decimal
text Text
price Price
file Link to file
- for objects
    images
        /files/crm/product/$filename - original
        /files/crm/product/resized200x200/$filename - small
        /files/crm/product/resized800x600/$filename - big
    other
        /files/crm/product/$filename
- for other files
    /files/crm/$filename
point geocoordinate 55.753366 37.620908
integer_range Integer range: from - to
decimal_range Decimal range: from - to
date_range Date range: from - to
time_range Time range: from - to
datetime_range Date+time range: from - to

Attention!

By default, the fields of type "select" and "multiselect", conditioned on the selection of the parent fields (nested_selects), are not rendered for objects and activities requested. They should be uploaded manually, as the number of selection options can reach up to several thousands.

Uploading selection options
URL: http://domainname.crma.pro:81/sharedapi/utils/variants
Github method: getSelectVariants
Params:
property_id - selection field ID
Uploading selection options attributed to specific values
URL: http://domainname.crma.pro:81/sharedapi/utils/binded
Github method: getBindedSelectVariants
Params:
bind - selection field ID
Obtaining the list of posts. Posts can be enclosed, or form sections.
URL: http://domainname.crma.pro:81/sharedapi/publication/list
Github method: getArticlesList
Params:
parent_id - parent field ID (obligatory field, root = 0)
Response: {
  1: {
    id: "1",
    description: "",
    news: "1",
    date_news: "2011-06-01 00:00:00",
    title: "News",
    publ: "1",
    childs: true
  },
  2: {
    id: "2",
    description: "",
    news: "0",
    date_news: "2011-06-01 00:00:00",
    title: "Object",
    publ: "1",
    childs: true
  }
}
  • id - post ID
  • description - short description
  • news - marked as news section
  • title - headline
  • publ - published
  • childs - has enclosed posts
Obtaining a post
URL: http://domainname.crma.pro:81/sharedapi/publication/single
Github method: getArticleContent
Params:
id - post ID
Response: {
  871: {
    id: "871",
    title: "Report #73 from 22.07.2014",
    description: "Assessment test",
    parent_id: "1",
    body: "",
    publ: "1",
    created_on: "2014-07-23 09:15:54",
    files: {
      2484: {
        title: "73_2014.pdf",
        url: "/file/load/2484"
      }
    },
    images: {
      382: {
        title: "Headline",
        description: "Description",
        width: 600,
        height: 400,
        url: "/images/article/382.jpg",
        preview: "/images/article/382_250x250.jpg"
      }
    },
    childs: [ ]
  }
}
  • id - post ID
  • title - headline
  • description - short description
  • parent_id - parent post ID
  • body - text
  • created_on - creation date
  • files - attached files
  • images - attached images
  • childs - array of enclosed posts
Requesting data from online form fields. All requests should be sent by the POST method.
URL: http://domainname.crma.pro:81/onlineforms
quide form integration samples
Params:
action - get form value
form - ID of the form requested
host - if you are using AJAX, you should specify the name of the website, from where the sitename.com request is sent
Response: {
  //form ID
  formtype: "1",
  //form name
  name: "Application for loan",
  //description
  description: "You can apply for a loan here",
  //text displayed to the user after the form is filled.
  feedback: "Thank you! We will get back to you shortly",
  //basic fields from contact profile. The structure of basic fields is similar to that of additional fields.
  def_customer: {
    //last name
    surname: {...},
    //first name
    name: {...},
    //patronymic
    patronymic: {...},
    //email address
    email: {...},
    //phone number
    phone: {...}
  },
  //fields from contact profile
  ext_customer: {
    //field ID
    31: {
      //field ID
      id: "31",
      //field name
      name: "Client status",
      //field name as displayed
      placeholder: "Client status",
      //obligatory
      require: "0",
      //prompt for form field
      tip: "",
      //prompt for CRM field
      hint: "",
      //type of data
      type_data: "select",
      //for fields of type "select" and "multiselect", if they are associated with a parent field.
      parent: "30",
      //selection options for fields of type "select" and "multiselect"
      variants: [
      //same as objects
      ]
    },
  },
  //fields of request
  ext_request: {
    //same as objects
  },
  //basic fields from object profile
  def_stock: {
    name: {...},
    parent: {
      ...
      //list of categories
      variants: [],
    }
  },
  //fields from object profiles
  ext_stock: {
    //same as contacts
  }
}
Sending a filled form
URL: http://domainname.crma.pro:81/onlineforms
guide form integration samples
Params:
action - fill form value
formtype - ID of form type
host - if you are using AJAX, you should specify the name of the website, from where the sitename.com request is sent
data - fields data
{
  //basic fields from contact profile
  def_customer: {
    //last name
    surname: '',
    //first name
    name: '',
    //patronymic
    patronymic: '',
    //email address
    email: '',
    //phone number
    phone: ''
  },
  //fields from contact profile
  ext_customer: {
    //field ID
    '24':{
      //value
      value: ''
    }
  },
  ext_request: {
    //field ID
    '67':{
      //value
      value: ''
    }
  },
  def_stock: {
    //name
    name: '',
    //category ID
    parent: '',
  },
  ext_stock: {
    //name
    '24':{
      //value
      value: ''
    }
  }
}
Response: {
  //status
  status: "success",
  //filled form ID
  form: "34"
}
Requesting all types of objects available
URL: http://domainname.crma.pro:81/sharedapi/stock/types
Params: no
Github method: getStockTypes
Response: [
  {
    id: "1",
    name: "Residential properties",
    groups: ["149","150"]
  },
  {
    id: "2",
    name: "Properties overseas",
    groups: ["150"]
  }
]
  • id - ID of object type
  • name - name
  • groups - CRM groups with access
Requesting all categories of objects available
URL: http://domainname.crma.pro:81/sharedapi/stock/category
Params: no
Github method: getStockCategory
Response: {
  14: [
    {
      id: "1",
      tree_id: "1",
      tree_parent: "0",
      name: "Heating radiators"
    },
    {
      id: "2",
      tree_id: "2",
      tree_parent: "1",
      name: "GLOBOL"
    },
    {
      id: "3",
      tree_id: "3",
      tree_parent: "1",
      name: "GABI SUPER"
    },
    {
      id: "4",
      tree_id: "4",
      tree_parent: "1",
      name: "GABI ELITE"
    }
  ]
}
  • 14 - ID of object type
  • id - ID of object category
  • tree_id - ID for enclosed object categories
  • tree_parent - parent ID for enclosed categories
  • name - name of object category
Obtaining the list and structure of fields for types of objects
URL: http://domainname.crma.pro:81/sharedapi/stock/fields
Github method: getStockFields
Params: no
Response: {
  35: {
    groups: [
      {
        id: "0",
        name: "",
        childs: ["387","346","343","342","440","341","442","426"],         order: "0"
      },
      {
        id: "10",
        name: "Price",
        order: "1",
        childs: ["340","339"]
      },
    ],
    fields: {
      338: {
        id: "338",
        name: "SKU",
        datatype: "text"
      },
      339: {
        id: "339",
        name: "Price (in dollars)",
        datatype: "price"
      },
      723: {
        id: "723",
        name: "Child",
        datatype: "select",
        variants: [
          {
            id: "1619",
            value: "Dean",
            bind: "1614",
            default: "0",
            highlight: "#336699",
            sort: "0"
          },
          {
            id: "1617",
            value: "Fender",
            bind: "1614",
            default: "0",
            highlight: "#327788",
            sort: "0"
          },
          {
            id: "1616",
            value: "Gibson",
            bind: "1614",
            default: "0",
            highlight: null,
            sort: "0"
          }
        ]
      }
    },
    nested_selects: {
      617: ["618","443"],
      618: ["695"],
      695: ["697"],
      722: ["723"]
    },
    deleted_fields: ["943","944","945"],
    disabled_fields: ["1023","1024","1025"]
    }
  }
}
  • 35 - ID of object type
  • groups - groups of properties
  •     id - group ID (0 - ungrouped properties)
  •     name - name
  •     childs - IDs of properties from the group
  •     order - order
  • fields - properties
  •     id - property ID
  •     name - name
  •     datatype variants - data type: property enlisting all selection options is available for fields of type "select" and "multiselect"         
              id - option ID
              value - value
              bind - association with the ID of parent selection option - for enclosed objects
              default - default selection
              highlight - color
              sort - order of assortment
  • nested_selects - enclosed properties of type "select" and "multiselect"
  • deleted_fields - array of deleted fields
  • disabled_fields - array of hidden fields
Search by various criteria in objects
URL: http://domainname.crma.pro:81/sharedapi/stock/filter
Github method: getStockByFilter
Params:
type - ID of object type (obligatory field)
category - ID of object category
nested - values "true" and "false"; including enclosed categories
search - search bar (can contain object name or fields of type "text", "select", and "multiselect" (for full search))
byid - object ID
manager - supervisor ID
groups - array of CRM groups
fields - array of search conditions by fields [{id:id properties,value: value},{...}] restrictions can be set for fields of type "integer", "decimal", "price", "time", "date", and "datetime":
    value: '>= value' - equal or above
    value: '<= value' - equal or below
    value: 'value_1 & value_2' - between 1 and 2
associated_with_customer - contact associated with object
order - "asc" - assortment in ascending order, "desc" - assortment in descending order
order_field - if "stock_activity_date" is specified as value, the selection will be assorted by activity date
date - {from: "2015-10-29 09:45:23", to: "2015-11-19 13:05:12"} selection for a certain period
date_field - if "stock_activity_date" is specified as value, the selection will be assorted by activity
page - page
publish - 1 - active, 0 - deleted, 1 by default
limit - number of entries in a selection: 20 by default, 500 max.
Response: {
  list: [
    {
      //object ID
      id: "106015",
      //category ID
      parent: "1",
      //name
      name: "Ford Fusion",
      //creation date
      date_add: "2014-09-19 12:54:34",
      //supervisor ID
      author: "47",
      //array of additional supervisor IDs
      additional_author: [48,49,50],
      //published
      publish: 1,
      //last edited
      last_modify: "2014-10-04 11:21:43",
      //contact ID
      customer_relation: "12643",
      //last activity type
      stock_activity_type: "edit",
      //last activity date
      stock_activity_date: "2015-11-20 11:34:54",
      //fields data
      fields: [
        {
          id: "342",
          type: "text",
          value: "43"
        },
        {
          id: "343",
          type: "decimal",
          value: null
        }
      ]
    }
  ],
  count: "369"
}
list - array of selected data
count - total of entries found
Adding new objects to the CRM (this operation requires access to entries)
URL: http://domainname.crma.pro:81/sharedapi/stock/insert
Github method: insertStock
Params: //array of the entries to be added
[
  {
    parent: 'Object category ID (obligatory field)'
    name: 'Name',
    author: 'Supervisor ID or 0',
    //array of additional supervisor IDs
    additional_author: [48,49,50],
    //proprietor ID
    associated_with_customer: 10643,
    //fields
    fields:[
      {
        id: 'Property ID',
        value: 'Property value'
      },
      {
      //geocoordinate
        id: 'Property ID',
    nbsp;    value: {
          lat: 'latitude',
          lon: 'longitude'
        }
      },
      {
      //range of values
        id: 'Property ID',
        value: ['value from','value to']
      },
      //file: if files are multiple, the section is duplicated.
      {
        id: 'Field ID of type "file"',
        value: 'name of the file uploaded to server'
      }
    ]
  },
  {
    //same as previous element
  }
]
You can find an example of files upload in section Utilities / Files upload
Response: //response contains the array of added objects
[19321,19322,...]
Editing CRM objects (this operation requires access to editing)
URL: http://domainname.crma.pro:81/sharedapi/stock/update
Github method: updateStock
Params: //editing entries is similar to adding entries: add object ID to the list of parameters
[
  {
    id:'ID of existing object',
    parent: 'Object category ID (obligatory field)'
    name: 'Name',
    author: 'Supervisor ID or 0',
    //array of additional supervisor IDs or "false" — in order to delete
    additional_author: [48,49,50],
    //proprietor ID
    associated_with_customer: 10643,
    //fields
    fields:[
      {
        id: 'Property ID',
        value: 'Property value'
      },
      {
        id: 'Property ID',
        value: 'Property value'
        mode: 'Specify "insert" to add, or "delete" to remove files'
      },
    ]
  },
  {
    //same as previous element
  }
]
Deleting CRM objects (this operation requires access to deletion)
URL: http://domainname.crma.pro:81/sharedapi/stock/delete
Github method: deleteStock
Params: // to delete objects, you need to send the array of their IDs [10234,10432,10342,...]
Obtaining the list of additional fields for user
URL: http://domainname.crma.pro:81/sharedapi/worker/fields
Github method: getBindedSelectVariants
Params: no
Response: [
  {
    id: "6",
    name: "Qualifications",
    datatype: "text"
  },
  {
    id: "7",
    name: "Employment history",
    datatype: "text"
  },
  {
    ;id: "8",
    name: "Previous job",
    datatype: "text"
  }
]
Same as objects
Obtaining the list of departments
URL: http://domainname.crma.pro:81/sharedapi/worker/department
Github method: getDepartment
Params: no
Response: [
  {
    id: "1",
    parent_id: "0",
    name: "Guidance",
    description: "",
    order: "1"
  },
  {
    id: "2",
    parent_id: "0",
    name: "Personnel management",
    description: "",
    order: "2"
  },
  {
    id: "3",
    parent_id: "0",
    name: "Marketing management",
    description: "",
    order: "3"
    }
]
id - department ID
parent_id - parent ID for enclosed departments
name - department name
description - description
order - order of assortment
Obtaining the list of branches
URL: http://domainname.crma.pro:81/sharedapi/worker/filiation
Github method: getFiliation
Params: no
Response: {
  id: "1",
  name: "East London",
  description: "",
  city: "London",
  address: "Union St. 17",
  phone: "44 20 XXXX 4567",
  email: "london-east@gmail.com"
}
id - department ID
name - name
description - description
address - address
phone - phone number
email - email address
Searching users by various criteria
URL: http://domainname.crma.pro:81/sharedapi/worker/filter
Github method: filterEmployee
Params:
group - CRM group ID
id - array of user IDs
division_id - array of department IDs
suboffice_id - array of branch IDs
surname - last name
name - first name
email - email address
phone - phone number
fields - array of conditions for additional properties (same as objects)
Response: {
  47: {
    id: "47",
    avatars: {
      original: "/images/avatars/d0e2c1bb.jpg",
      170: "/images/avatars/d0e2c1bb170.jpg",
      55: "/images/avatars/d0e2c1bb55.jpg",
      40: "/images/avatars/d0e2c1bb40.jpg",
      30: "/images/avatars/d0e2c1bb30.jpg"
    },
    type: "admin",
    division_id: "1",
    suboffice_id: "1",
    post: "Manager",
    boss: "0",
    name: "Nolan",
    surname: "Mark",
    patronymic: "Adam",
    internalemail: [
      {
        email: "nolanma@hotmail.com",
        comment: ""
      }
    ],
    externalemail: [
      {
        email: "nolanma@hotmail.com",
        comment: ""
      }
    ],
    internalphone: [ ],
    externalphone: [ ],
    mobilephone: [
      {
        phone: "1202 XXX 0191",
        comment: "",
        link: ""
      }
    ],
    birthday: "1968-08-09",
    address: null,
    about: null,
    hobby: null,
    created_on: "0000-00-00 00:00:00",
    gender: "male",
    fields: {
      1: {
        id: "1",
        datatype: "date",
        value: "2014-09-29"
      },
      12: {
        id: "12",
        datatype: "radio",
        value: "1"
      }
    },
    asterisk_short_number: ["100","101","103"]
  }
}
id - user ID
avatars - array of profile pictures of various sizes, including the original
type - possible values: "admin", "hr", "general manager", "simple"
division_id - department ID
suboffice_id - branch ID
post - position
boss - marked as department manager
name - first name
surname - last name
patronymic - patronymic
internalemail,externalemail - internal and external email
internalphone,externalphone,mobilephone - internal and external phones, and mobile phone
birthday - date of birth
address - address
about - description
hobby - hobby
created_on - registration date
gender - sex: male, female
fields - fields (same as objects)
asterisk_short_number - asterisk extension
Obtaining the list of CRM groups available
URL: http://domainname.crma.pro:81/sharedapi/managergroup
Github method: getAvailGroups
Params: no
Response: [
  {
    id: "149",
    name: "Car dealer #1"
  },
  {
    id: "150",
    name: "Car dealer #2"
  }
]
id - CRM group ID
name - group name
Obtaining fields from contact profile
URL: http://domainname.crma.pro:81/sharedapi/purchaser/fields
Github method: getCustomerFields
Params: no
Response: See "Obtaining object fields"
Search in contacts
URL: http://domainname.crma.pro:81/sharedapi/purchaser/filter
Github method: filterCustomers
Params:
groups - array of CRM groups
manager - supervisor ID
byid - contact ID
marktype - array of type IDs
nattype - subtypes: "private_individual" - private individual, "legal_entity" - legal entity; both displayed by default
search - search bar (can contain first name, last name, email address, phone number)
fields - array of conditions for additional properties (same as objects)
order - "asc" - assortment in ascending order, "desc" - assortment in descending order
order_field - if "customer_activity_date" is specified as value, the selection will be assorted by activity date
date - {from: "2015-10-29", to: "2015-11-19"} selection for a certain time period
date_field - if "customer_activity_date" is specified as value, the selection will be assorted by activity
page - page
publish - 1 - active, 0 - deleted, 1 by default
limit - number of entries in selection (50 max.)
Response: {
  list: [
    {
      //contact ID
      id: "10607",
      //CRM group ID
      group_id: "149",
      //last name
      surname: "Moore",
      //first name
      name: "Mary",
      //patronymic
      patronymic: "Ann",
      //supervisor ID
      manager_id: "47",
      //array of additional supervisor IDs
      additional_manager_id: [48,49,50],
      //creation date
      create_date: "2014-08-29 12:11:35",
      //contact type
      marktype: "0",
      //name of contact type
      markname: "Not specified",
      //subtypes: "private_individual" - private individual, "legal_entity" - legal entity
      nattype: "private_individual",
      //last activity type
      customer_activity_type: "supervisor",
      //last activity date
      customer_activity_date: "2015-11-20 11:08:51",
      //list of email addresses
      email: [
        {
          mail: "customer@gmail.com",
          comment: ""
        }
      ],
      //list of phone numbers
      phone: [
        {
          phone: "1965 XXX 4332",
          comment: "Main"
        },
        {
          phone: "1423 XXX 2253",
          comment: "Second"
        }
      ],
      //fields data
      fields: {
        25: {
          id: "25",
          datatype: "integer",
          value: "34"
        }
      }
    }
  ],
  count: "1"
  }
}
list - array of selected data
count - total of entries found
Same as objects       (Github method: insertCustomers)
Available fields:
source - one of the options: "online_consult", "manager_customer", "help_manager", "mobile"
name - first name
surname - last name
patronymic - patronymic
manager_id - supervisor ID
additional_manager_id - array of additional supervisor IDs
marktype - type
email - list of email addresses
phone - list of phone numbers
comment - comment
Same as objects       (Github method: updateCustomers)
Same as objects      (Github method: deleteCustomers)
Obtaining the CRM elements associated to contact
URL: http://domainname.crma.pro:81/sharedapi/purchaser/attach
Github method: getCustomerAttachments
Params:
ids - array of contact IDs or single value
Response: {
  //contact ID
  "278056": {
    //associated objects
    "stock":["280959","280960","280961"],
    //associated objects (archive)
    "stock_archive":["280957","280958"],
    //associated activities
    "request":["1969","1970","1971"],
    //associated deals
    "sale":["522","527","528","529"]
  }
}
Obtaining the list of activity types
URL: http://domainname.crma.pro:81/sharedapi/applications/types
Github method: getRequestTypes
Params: no
Response: [
  {
    id: "1",
    name: "Request for rent",
    service: "0",
    groups: ["149"]
  },
  {
    id: "2",
    name: "Request for sale",
    service: "0",
    groups: ["149","150","151"]
  }
]
id - activity ID
name - name
service - marked as service
groups - list of groups with the access to this type
Obtaining the list of activity fields
URL: http://domainname.crma.pro:81/sharedapi/applications/fields
Github method: getRequestFields
Params: no
Response: See "Obtaining object fields"
Search in activities
URL: http://domainname.crma.pro:81/sharedapi/applications/filter
Github method: filterRequests
Params:
search - search bar (can contain contact's last name or words from comments/activity name)
groups - array of CRM groups
manager - supervisor ID
byid - activity ID
customer - contact ID
types - array of type IDs
order - "asc" - assortment in ascending order, "desc" - assortment in descending order
order_field - if "request_activity_date" is specified as value, the selection will be assorted by activity date
date - {from: "2015-10-29", to: "2015-11-19"} selection for a certain time period
date_field - if "request_activity_date" is specified as value, the selection will be assorted by activity
statuses - array of status IDs
    "unselected" - not specified
    "mustbeprocessed" - requires processing
    "processnow" - requires urgent processing
    "processed" - processed
    "postponed" - postponed
    "malformed" - invalid
    "cancelled" - cancelled
    "reprocess" - requires improvement
page - page
publish - 1 - active, 0 - deleted, 1 by default
limit - number of entries in selection (50 max.)
Response: {
  list: [
    {
      //activity ID
      id: "1355",
      //supervisor ID
      employee_id: "47",
      //array of additional supervisor IDs
      additional_employee_id: [48,49,50],
      //contact ID
      customer_id: "14739",
      //activity type
      request_type_id: "1",
      //activity name
      request_type_name: "Test",
      //source
      source: "help_manager",
      //creation date
      date_create: "2013-09-16 16:49:15",
      //comment
      comment: "To processing",
      //activity name
      request_name: "Application for loan",
      //activity status
      status: "mustbeprocessed"
      //last activity type
      request_activity_type: "stage",
      //last activity date
      request_activity_date: "2015-11-20 10:36:29",
      //fields data
      fields: { ... }
    }
  ],
  count: "460"
}
list - array of selected data
count - total of entries found
Same as objects       (Github method: insertRequests)
Available fields:
source - one of the options: "online_consult", "none", "help_manager", "online_form"
customers_id - contact ID (obligatory field)
employee_id - supervisor ID
additional_employee_id - array of additional supervisor IDs
comment - comment
request_name - activity name
status - one of the options: "unselected", "mustbeprocessed", "processnow", "processed", "postponed", "malformed", "cancelled", "reprocess"
request_type - activity type ID (obligatory field)
Same as objects      (Github method: updateRequests)
Same as objects       (Github method: deleteRequests)
Obtaining the list of deal types
URL: http://domainname.crma.pro:81/sharedapi/sales/types
Github method: getSaleTypes
Params: no
Response: [
  {
    id: 1,
    name: "Sale",
    stages: [
      {
        id: 1,
        name: "Signing contract",
        color: "#EDF18A",
        order: 10,
        is_success: true
      },
      {
        id: 2,
        name: "Registration",
        color: "#B5D67D",
        order: 11,
        is_fail: true
      }
      {
        id: 3,
        name: "Advance payment made",
        color: "#AEEBE6",
        order: 12
      }
    ]
  }
]
id - deal type ID
name - name
stages - list of deal stages
  •   id - deal stage ID
  •   name - deal stage name
  •   color - deal stage color
  •   order - position in the list
  •   is_success - successfulness
  •   is_fail - unsuccessfullness
Obtaining the list of fields for all types of deals
URL: http://domainname.crma.pro:81/sharedapi/sales/fields
Github method: getSaleFields
Params: no
Response: {
  34: {
    stages: {
      0: [374,843,123,432],
      1: [765,245,155],
      2: [760,876,543,164,518]
    },
    price_fields: [339,340,341],
    fields: {
      338: {
        id: "338",
        name: "SKU",
        datatype: "text"
      },
      339: {
        id: "339",
        name: "Price (in dollars)",
        datatype: "price"
      },
      723: {
        id: "723",
        name: "Child",
        datatype: "select",
        variants: [
          {
            id: "1619",
            value: "Dean",
            bind: "1614",
            default: "0",
            highlight: "#336699",
            sort: "0"
          },
          {
            id: "1617",
            value: "Fender",
            bind: "1614",
            default: "0",
            highlight: "#327788",
            sort: "0"
          },
          {
            id: "1616",
            value: "Gibson",
            bind: "1614",
            default: "0",
            highlight: null,
            sort: "0"
          }
        ]
      }
    },
    nested_selects: {
      422: [421],
      737: [738,739]
    }
  }
}
34 - deal type ID
stages - groups of fields for stages, (0 - ungrouped deal fields)
price_fields - fields containing deal value
fields - list of fields
nested_selects - enclosed properties of type "select" and "multiselect"
Obtaining the list of deals
URL: http://domainname.crma.pro:81/sharedapi/sales/filter
Github method: filterSales
Params:
search - search bar
type - array of deal type IDs
stage - array of deal stage IDs
customer - contact ID
manager - supervisor ID
page - page
publish - 1 - active, 0 - deleted, 1 by default
limit - number of entries in selection (50 max.)
byid - obtaining deal and its ID
order - "asc" - assortment in ascending order, "desc" - assortment in descending order
order_field - if "sale_activity_date" is specified as value, the selection will be assorted by activity date
date - {from: "2015-10-29", to: "2015-11-19"} selection for a certain time period
date_field - if "sale_activity_date" is specified as value, the selection will be assorted by activity
Response: {
  list: [
    {
      //deal ID
      id: 420,
      //contact ID
      customers_id: 238515,
      //supervisor ID
      employee_id: 47,
      //array of additional supervisor IDs
      additional_employee_id: [48,49,50],
      //creation date
      date_create: "2015-11-19 16:44:45",
      //deal type ID
      sales_type_id: 8,
      //stage ID
      sales_status_id: 12,
      //deal name
      sale_name: "In stock",
      //last activity type
      sale_activity_type: "stage",
      //last activity date
      sale_activity_date: "2015-11-19 17:17:11",
      //fields data
      fields: { ... }
    }
  ],
  count: 1
}
list - array of selected data
count - total of entries found
Obtaining additional data about deals associations with other CRM elements
URL: http://domainname.crma.pro:81/sharedapi/sales/details
Github method: getSaleDetails
Params:
ids - array of deal IDs
Response: {
  //deal ID
  468: {
    //list of co-buyer IDs
    cocustomers: [],
    //list of associated activity IDs
    corequests: [],
    //list of associated object IDs
    costock: [],
    //list of object IDs
    costockprimary: [],
    //list of associated deal IDs
    cosales: [],
    //list of invoice IDs
    bills: [],
    //list of template IDs
    blanks: []
  }
}
Same as objects      (Github method: insertSales)
Available fields:
customers_id - contact ID
employee_id - supervisor ID
additional_employee_id - array of additional supervisor IDs
sales_type_id - deal type ID
sales_status_id - deal stage ID
sale_name - deal name
fields - fields data
Same as objects       (Github method: updateSales)
Same as objects       (Github method: deleteSales)
Request: selection of invoices on each page with search and filter applied
URL: http://domainname.crma.pro:81/sharedapi/accounts/get
Github method: billsGet
Params:
type - type of invoice: in/out
date_start - invoice created on this date or later (format: dd.mm.yyyy / yyyy-mm-dd)
date_start - invoice created on this date or earlier (format: dd.mm.yyyy / yyyy-mm-dd)
active - active / inactive invoices (1,0)
pay_status - payment status: "not", "part", "full"
client_id - contact ID
search - search bar: search by invoice number, contact's last name, company name
company_id - ID of contact's payment details
sale_id - ID of associated deal
not_sale_id - selection of entries not associated with the deal specified: if "sale_id" and "not_sale_id" are both specified in the filter, "not_sale_id" is ignored
ids - selection of entries from the array / line (divided by ",") of invoice IDs, with filter applied; filter cleared by default
orderType - "asc" - assortment in ascending order, "desc" - assortment in descending order
order - assortment field ("b.id" - invoice ID, "b.date_create" - invoice creation date)
limit - the number of results on one page: 1000 by default
page - output page number
Filter by default: {
  page : 1,
  limit : 1000,
  order : 'b.id',
  orderType : 'DESC',
  type : 'all',
  bill_active : 1,
  client_id : 0
}
Response: {
  filter: {},
  limit: 1000,
  page: 1,
  total: 6000,
  list: [
    {
      act_id: "0"
      author: "1"
      author_name: "CRM Т. "
      bill_active: "1"
      client_company_id: "84"
      client_id: "10475"
      date_create: "2015-10-06"
      hash: "23d86626b1673482dc74e93431883300"
      id: "112"
      my_company_id: "2"
      nds: "0"
      outer_id: ""
      pay: "0.00"
      pay_status: "not"
      payer: " Т."
      payment_date: "0000-00-00"
      recipient: "Basic payment details"
      sale_id: "0"
      stockgroup_id: "199"
      summ: "5000.00"
      type: "out"
    }
  ]
}
filter - array of filter parameters
limit - number of results
page - results page
total - total of entries matching the filter
list - array of entries
  author - creator ID
  author_name - creator name
  bill_active - post status
  client_company_id - ID of contact's payment details
  client_id - contact ID
  date_create - creation date; format: yyyy-mm-dd
  hash - unique hash for printing templates
  id - invoice ID
  my_company_id - ID of company's payment details
  outer_id - external key
  pay - invoice paid
  pay_status - payment status: "not" - unpaid, "part" - partially paid, "full" - fully paid
  payer - payer name
  payment_date - payment date
  recipient - beneficiary name
  sale_id - associated object ID
  stockgroup_id - ID of objects list
  summ - amount
  type - type: "out" - outbound / "in" - incoming
Obtaining full information about invoices, using the list of invoice IDs
URL: http://domainname.crma.pro:81/sharedapi/accounts/get_full
Github method: billsGetFull
Params:
ids - array of invoice IDs
Response: {
   act_id: "0"
   author: "1"
   author_name: "Travis C."
   bill_active: "1"
   client: {
     id: "10440"
     logo: "10"
     name: "Jane"
     patronymic: ""
     surname: "McCay"
   }
   client_company: {
    bank_name: "Royal Phoenix Bank"
    bank_city: "Phoenix"
    bik: "042204757"
    email: ""
    id: "11"
    inn: "2311111067"
    kpp: ""
    ks: "30101810300000000757"
    legal_address: ""
    mail_address: ""
    name: "Tech&Tech Inc."
    ogrn: ""
    phone: ""
    rs: ""
    city: ""
    type: "0"
   }
   date_create: "2015-10-06"
   hash: "23d86626b1673482dc74e93431883300"
   id: "112"
   my_company: {
    bank_name: "Bank of Philadelphia"
    bank_city: "Philadelphia"
    bik: "3046311854"
    email: "test@test.com"
    id: "2"
    inn: "34511102704"
    kpp: "711101001"
    ks: "65464654646545"
    legal_address: "229, Arch St."
    mail_address: "4305117"
    name: "Basic payment details"
    ogrn: "54645645"
    phone: "1784XXX6427"
    rs: "40702810711030001415"
    city: "Philadelphia"
    type: "Inc."
   }
   nds: "0"
   outer_id: ""
   pay: "0.00"
   pay_status: "not"
   payer: {
     client: "client"
     company: "client_company"
     name: "Paperworks Ltd."
   }
   payment_date: "0000-00-00"
   products: [
   {
     count: "10"
     id: "254"
     name: "Stationery and office supplies"
     price: "500.00"
     stockgroup_id: "199"
     summary: "5000.00"
   }
   ]
   recipient: {
     client: "firm"
     company: "my_company"
     name: "Basic payment details"
     type: "legal"
   }
   sale_id: "0"
   stockgroup_id: "199"
   summ: "5000.00"
   to_pay: "5000.00"
   total: "5000.00"
   type: "out"
}
bill_active - post status
client - array of contact info
    id - unique CRM number
    logo - user logo
    name - first name
    patronymic - last name
    surname - patronymic
client_company - contact's payment details
    bank_name - name of the bank
    bank_city - city of the bank
    email - email address
    id - unique CRM number
    legal_address - legal address
    mail_address - postal address
    name - name
    phone - phone number
    city - city
    type - type
date_create - creation date
hash - unique hash for printing templates
id - unique CRM number
my_company - array of associated company's payment details (fields coincide with those of contact's payment details)
outer_id - unique external (synchronizing) reference
pay - paid
pay_status - payment status
payer - array of payer links
payment_date - date of payment
products - array of objects
recipient - array of beneficiary links
sale_id - unique CRM reference of associated deal
stockgroup_id - objects list reference
summ - invoice amount
to_pay - for payment (VAT included)
type - type of invoice
API for adding invoices. Invoices for addition should be submitted to the CRM in an array. The maximum number of invoices submitted at a time is 1000.

The response is also rendered in an array, with a result about each invoice, including error key and description, in case the addition failed.

URL: http://domainname.crma.pro:81/sharedapi/accounts/add
Github method: billsAdd
Params:
[
  {
    date_create - creation date
    product - array of objects
        count - object quantity
        name - object name
        price - object price
    sale_id - ID of associated deal
    stockgroup_id - ID of objects list
    client_company_id - ID of contact's payment details
    client_id - contact ID
    my_company_id - ID of company payment details
    nds - VAT
    type - type: "out" - outbound / "in" - incoming
  }
]
Response:   [
     0:{
       id: 113,
       stat: 1
     },
     1:{
       stat:0,
       error: [
         {
           key: 1,
           mes: "Contact not specified"
         },
         {
           key: 4,
           mes: "List of objects not specified"
         }
       ]
    
     }
  ]
stat - result: 1 - successful, 0 - error
id - unique invoice number
error - array of errors
    key - error key
  1. Contact not specified
  2. Company payment details not specified
  3. Date not specified
  4. List of objects not specified
  5. No valid objects (please specify "name", "count", "price")
    mes - description of error
API for updating invoices. Invoices for editing should be submitted to the CRM in an array. The maximum number of invoices submitted at a time is 1000.

The response is also rendered in an array, with a result about each invoice, including error key and description, in case the update failed.

URL: http://domainname.crma.pro:81/sharedapi/accounts/add
Github method: billsUpdate
Params:
[
  {
    bill_id - unique invoice number
    product - array of objects
        count - object quantity
        name - object name
        price - object price
    sale_id - ID of associated deal
    stockgroup_id - ID of objects list
    client_company_id - ID of contact's payment details
    client_id - contact ID
    my_company_id - ID of company payment details
    nds - VAT
    type - type: "out" - outbound / "in" - incoming
  }
]
Response: See "Adding invoices"
API for editing invoice parameters
URL: http://domainname.crma.pro:81/sharedapi/accounts/edit
Github метод: billsEdit
Params:
{
  bill_id - unique invoice number
  date_create - creation date; format: yyyy-mm-dd / dd-mm-yyyy
  product - array of objects
      count - object quantity
      name - object name
      price - object price
  sale_id - ID of associated deal
  outer_id - external ID
  client_company_id - ID of contact's payment details
  client_id - contact ID
  my_company_id - ID of company payment details
  nds - VAT
  is_cash - payment by cash
  type - type: "out" - outbound / "in" - incoming
}
Response: stat:0,
error: {
   key: 1,
   mes: "Obligatory parameter "bill_id" not submitted"
}
stat - result: 1 - successful, 0 - error
error - array of errors
    key - error key
  1. Obligatory parameter "bill_id" not submitted
  2. Invalid date
  3. Deal does not exist
  4. Contact does not exist
    mes - description of error
API for setting invoice payment status to "Partially paid" or "Fully paid".

The response is rendered in an array with the following parameters: "stat", "status_pay", or "error" — in case of error.

URL: http://domainname.crma.pro:81/sharedapi/accounts/set_pay
Github method: billsSetPay
Params:
{
  id - unique payment number
  pay - payment amount (complementary)
}
Response:    {
     stat: 0,
     status_pay: "not",
     error:{
       key:6,
       mes:"Obligatory parameter "ID" not submitted"
     }
   }
stat - result: 1 - successful, 0 - error
status_pay - current status
  •   'not' = unpaid
  •   'part' = partially paid
  •   'full' = fully paid
error - array of errors
  key - error key
  •   6 - Obligatory parameter "ID" not submitted
  •   7 - Invoice not found or has no associated objects
  mes - description of error
API for uploading files
URL: http://domainname.crma.pro:81/sharedapi/utils/upload
Github method: uploadFile
Params:
object - one of the possible values: "stock", "applications", "purchaser"
upload - name of the file uploaded: multiple uploads are possible
Response: {
  name: "54cf4e91db8ba.jpg"// name of the file uploaded / array of values for multiple uploads
}
For comments, use the following request
URL: http://domainname.crma.pro:81/sharedapi/[object_type]/comments
Possible values for object type: "stock", "applications", "purchaser", "sales"
Github method: getComments, for example getStockComments
Params:
entity_id - ID or array of IDs
Response: All comments to the objects, activities, and deals associated with a contact are displayed for it {
  //ID
  273954: [
  //array of IDs
    {
      //internal ID
      id: "492",
      //type of CRM element
      parent_type: "sale",
      //ID
      parent_id: "447",
      //text of comment
      text: "Comment text",
      //date of updates
      date: "2016-05-31 12:13:15",
      //contact ID if available
      customer_id: "273954",
      //supervisor ID
      author_id: "47",
      //list of files attached
      files: [
        {
          id: "66",
          parent: "492",
          name: "business_filter_q_2.png",
          size: "201085",
          file: "/files/crm/ribbon/574d479b30ce8.png"
        }
      ]
    }
  ]
}
SMS
Go to page "SMS sending parameters" and click "Add provider" of "API integration" type and with the following fields:
- API key:an entry of 32 characters generated by APRO CRM server — indispensable for requests
- Contact gateway:URL of the script getting requests from APRO CRM
- APRO CRM gateway:URL of the script for sending requests to contacts

Add sender name/phone number, specifying the provider you just created. APRO CRM can only receive SMS messages sent to the phone numbers added in the administration panel.

sendSmssend SMS
smsStatusget current SMS sending/delivery status
smsReceivedget new message
Requests are sent to the relevant URLs by the POST method, and responses are rendered in JSON format. The obligatory parameters of request are "action" and "hash".
Request hash is calculated as follows:
  • 1. key-value matches are assorted by the key name;
  • 2. values are merged in one entry;
  • 3. an ARI key is added to the entry;
  • 4. hash constitutes value MD5 from the entry.
These actions are performed both on the request sending and the recipient ends; the request is considered correct only if hashes coincide.
sendSms request
Parameters: action = sendSms
sender = sender_name
destination = destination_number
message = sms_text
Response If an SMS was queued for sending correctly, the response will comprise the following fields: {
  "success":true,
  "data":97687 // unique SMS ID (> 0)
}
In case of error: {
  "success":false,
  "data":"reason of error"
}
smsStatus request
Parameters: action = smsStatus
sms_id = sms_numeric_reference
Response In case of success: {
  "success":true,
  "count":2 //number of SMS sent
  "status":"new" //current sending status
}
In case of error: {
  "success":false
}
In this case, APRO CRM server will repeat the request later.
newqueued for sending
inprogressbeing sent
sendsent
delivereddelivered
notdeliverednot delivered
blockedsending impossible
absentsubscriber unavailable
notfoundSMS with this ID not found
smsReceived request
Parameters: action = smsReceived
sms_id = sms_numeric_reference (> 0)
sender = sender_number
destination = destination_number
message = sms_text
count = number_of_sms_messages
date = date_received_in_unix_timestamp (non-obligatory parameter)
Response If an SMS was added in APRO CRM correctly, the response will be as follows: {
  "success":true
}
If the server cannot process the request, and the request should be repeated later, the response will be as follows: {
  "success":false,
  "repeat":true
}
In case of error, when there is no need to repeat the request, the response will be as follows: {
  "success":false,
  "repeat":false,
  "error":"reason of error"
}
To start working with telephony, go to page "Settings" — "Integrations" — "API v 2" and create an API key with a permission for "Calls". All the subsequent requests must contain this key.
Requests are sent to: http://domainname.crma.pro:81/sharedapi/calls/[request_name], where domainname is replaced by your domain name in the CRM.
Sample request: {
  apikey: /* key of 32 characters */,
  params: /* associative array of parameters */
}
Response is available in JSON format.
trunks obtain the list of connections
phoneNumbers obtain the list of phone numbers for incoming and outbound calls
statuses obtain the list of call statuses available (only statuses set manually by users)
history obtain calls history
update edit call
import import one call into the history
importall import several calls into the history by one request
call create call
trunks request
Parameters: no
Response List of all CRM connections: {
  "status":"success",
  "data":[{
    "trunk_id":"4",
    "name":"1349 XXX 3456",
    "prov":"MANGO",
    "phone":"1349 XXX 3456",
    "take_input":"1"
  }]
}
In case of error: {
  "status":"fail",
}
phoneNumbers request
Parameters no
Response List of all phone numbers for incoming and outbound calls in the CRM: {
  "status":"success",
  "data":{
    "in":[{
      "trunk_id":"4",
      "phone":"1357 XXX 3456",
      "title":"1357 XXX 3456"
    }],
    "out":[{
      "trunk_id":"4",
      "phone":"1357 XXX 3456",
      "title":"1357 XXX 3456",
      "default_landing":"1"
    }]
  }
}
In case of error: {
  "status":"fail",
}
statuses request
Parameters no
Response List of all statuses that can be set to calls: {
  "status":"success",
  "data":[{
      "id":"1",
      "order":"1",
      "color":"#91C8EE",
      "text":"To processing",
      "public":"1"
    },{
      "id":"2",
      "order":"2",
      "color":"#E9BCBA",
      "text":"Urgent",
      "public":"1"
    },{
      "id":"3",
      "order":"3",
      "color":"#BABADD",
      "text":"Call back",
      "public":"1"
    }]
}
In case of error: {
  "status":"fail",
}
history request
Parameters fromPhone   filter by caller phone number
toPhone   filter by destination phone number
dateFrom   search calls after date
dateTo   search calls before date
type   type of call: "in", "out"
limit   response limit in the number of entries (1000 max.)
page   defines the results page together with the limit
orderField   assort by field (date field by default)
orderType   order of assortment: "ASC", "DESC" (by default "DESC")

Response List of calls in the history, considering the filters: {
  "status":"success",
  "data":[{
      "id":"27402",
      "date_time":"2016-07-21 12:11:47",
      "user_id":"52",
      "is_incoming":"1",
      "is_answered":"0",
      "custom_status":"2",
      "from_phone":"1937 XXX 8888",
      "to_phone":"1749 XXX 3456",
      "trunk_id":"4",
      "call_duration":"64",
      "url_record":"https://yourdomain.crma.pro/files/records/20....."
    },
      ...
    }]
}
In case of error: {
  "status":"fail",
}
These request types use the general parameters of call. Some parameters are only available when creating a call, and cannot be modified or edited later.

Parameters available only when creating/adding call:
uniqueId unique call reference: an entry of 32 characters
from phone number, from which the call was issued
to phone number, to which the call was issued
trunkId ID of connection, through which the call was made
callerId caller ID (same as caller phone number, as a rule)
timestamp time of call — preferably in Unix Timestamp or MYSQL with GMT shift
isIncoming call direction in relation to the CRM: "true" or "1" - incoming, other - outbound
url URL of call recording: the call will be downloaded or saved in the CRM
callDuration call duration in seconds
isAnswered whether the call was answered
customStatus ID of the status set for call

Parameters available when updating call:
uniqueId unique reference of the call to be updated
url URL of call recording: the call will be downloaded or saved in the CRM
callDuration call duration in seconds
isAnswered whether the call was answered
customStatus ID of the status set for call
The fields from the lists above are submitted to the "import" and "update" requests in the associative array "params".
Array "params[calls][]" is submitted to array "importall" together with the calls to be imported.
Response {
  "result": true,
  "callId":"ewegm0nrsy4nzbz4t48e7lp403dngr8v"
}
In case of error: {
  "result":false,
  "error":"text of error"
}
call — request from the CRM to create a call
You can create a virtual connection in telephony settings, and assign an outbound phone number and a user for it. The CRM will send the "call" to the URL you specified each time a user makes a call through this virtual connection.
Parameters: action = call
phone_to   which phone number to call
phone_from   which phone number to use for the call
user_id   user ID in the CRM
key   key specified when creating connection

Response Server response in JSON format: {
  "success": true
}
In case of error: {
  "success": false,
}
All API requests associated with external conversations have the "[object_type] = externaldialogs" parameter.
Request is multifunctional and is conditioned on the set of parameters.
[subtype] insert
URL: http://domainname.crma.pro:81/sharedapi/externaldialogs/insert
Params:
customer - contact ID in APRO CRM
Optional, if the conversation needs to be associated with a contact.
If you need to create a conversation without associating it to contact, just specify "0" in parameter "customer".
dialog - set of properties of conversation type
id - requisite ID of conversation type
Optional: if this parameter is specified, other parameters in the "group" are ignored.
name - name of the new type of conversation
When creating a new conversation.
employees - list of conversation participants
List of user IDs.
Response In any case, the response will contain a "clientkey": {
  "clientkey" : "c62f4c374e28bad97ab57256aeb034b8"
}

Attention!

Save the "clientkey" for further usage:
In case "dialogid.id" is not specified, the response will contain "dialogid" - ID of the conversation type created: {
  "clientkey" : "c62f4c374e28bad97ab57256aeb034b8" ,
  "dialogid"  : 56
}
Request for changing conversation type ("Name", "Users").
[subtype] update
URL: http://domainname.crma.pro:81/sharedapi/externaldialogs/update
Params:
id - ID of conversation type (obligatory)
name - new name of conversation type (optional)
Specify the new name, if it needs to be changed.
employees - new list of participants (optional)
List of user (participant) IDs, if they need to be changed.
Response status - boolean: operation completion status {
  "status" : true
}
Request for listing of conversation types by pages.
[subtype] groupslist
URL: http://domainname.crma.pro:81/sharedapi/externaldialogs/dialogtypeslist
Params:
page - number of the page requested (0 - first page)
If this parameter is absent, the first page will be rendered.
count - number of entries on page (30 by default)
Integer between 10 and 50 (inclusive).
Response list - array of conversation types {
  "list" : []
}
Request for listing the history of messages by pages.
[subtype] history
URL: http://domainname.crma.pro:81/sharedapi/externaldialogs/history
Params:
group - ID of conversation type (obligatory)
client - client key (obligatory)
date - timestamp (obligatory)
Deadline - all messages before the deadline specified are rendered.
page - number of the page requested (0 - first page)
If this parameter is absent, the first page will be rendered.
The history is rendered starting from the latest message.
count - number of entries on page (30 by default)
Integer between 10 and 50 (inclusive).
Response list - array of conversation types {
  "list"  : [// List of messages
    {
      "sender_type" : "apro crm" ,// client - message from external contact | apro crm - message from user
      "text" : "test" ,// message text (url encode)
      "author" : "1" ,// sender ID (only for sender_type = apro crm)
      "date" : "1474635572668" ,// timestamp (milliseconds)
      "hash" : "c70512f34fd2a233427b9d00b0cdc2fb" ,// unique message key
      "status" : false// marked as read
    }
  ] ,
  "total" : 10 // Total of messages
}
Request for the listing of unread messages.
[subtype] notread
URL: http://domainname.crma.pro:81/sharedapi/externaldialogs/notread
Params:
groups - list of IDs of conversation types (obligatory)
client - client key (obligatory)
Response list - array of conversation types {
  "list"  : {// List of messages
    "1"/* conversation ID */ : ["c70512f34fd2a233427b9d00b0cdc2fb"]
  }
}
All API requests associated with organizer have the "[object_type] = org_events" parameter.
Request for the listing of events by pages
[subtype] list
URL: http://domainname.crma.pro:81/sharedapi/org_events/list
Params:
filters - filters
publ - show deleted (1 - not deleted, 0 - deleted , all - all)
page - number of the page requested (0 - first page)
If this parameter is absent, the first page will be rendered.
count - number of entries on page (50 by default)
Integer between 10 and 50 (inclusive).
Response
list - array of events
total - the total of events matching the specified filters
{
  "list"  : [
    {
      "id"              : "Event ID" ,
      "title"           : "Event name" ,
      "publ"            : "1" ,
      "description"     : "Event description" ,
      "allDay"          : "0" ,
      "duration"        : "15" ,
      "remind_active"   : "yes" ,
      "remind_before"   : "15" ,
      "year"            : "2017" ,
      "month"           : "04" ,
      "day"             : "27" ,
      "weekday"         : "4" ,
      "hour"            : "12" ,
      "minute"          : "00" ,
      "textColor"       : "#000000" ,
      "backgroundColor" : "#EFEFEF" ,
      "borderColor"     : "#EFEFEF" ,
    }
  ] ,
  "total" : 1
}
Info about event
[subtype] get
URL: http://domainname.crma.pro:81/sharedapi/org_events/get
Params:
id - reminder ID
Response
event - event data (same as when creating event)
users - array with the info about event participants
key - user ID
values: "simple" - regular, "root" - moderator (initiator)
Adding a new event in the organizer
Don't forget to activate the following parameters in the API settings of the key.
[subtype] insert
URL: http://domainname.crma.pro:81/sharedapi/org_events/insert
Params:
event - array with the info about event
title - event name (obligatory)
date - event date in any conventional format with time zone shift indication (in case time zone shift is not specified, the GMT time zone will be set by default): obligatory.
The time indication will be rounded out to a multiple of 5 minutes, for instance:
18:01 will be modified to 18:00
18:03 will be modified to 18:05
For example:
PHP - date("from"); «2017-04-27T10:49:48+04:00»
Javascript - new Date().toString(); «Thu Apr 27 2017 10:49:48 GMT+0400»
description - event description
allDay - whole day event ("1" - yes, "0" - no)
duration - event duration in minutes (multiple to 5 minutes)
remind_active - notification activated ("yes" - yes , "no" - no)
remind_before - timelapse before the event for showing the notification (multiple to 5 minutes)
textColor - style arrangement (text color)
backgroundColor - style arrangement (background color)
borderColor - style arrangement (frame color)
users - array with the info about event participants
key - user ID
values: "simple" - regular , "root" - moderator (initiator)
Response
event - event info
{
  "event" : {
    "id"              : "Event ID" ,
    "title"           : "Event name" ,
    "publ"            : "1" ,
    "description"     : "Event description" ,
    "allDay"          : "0" ,
    "duration"        : "15" ,
    "remind_active"   : "yes" ,
    "remind_before"   : "15" ,
    "year"            : "2017" ,
    "month"           : "04" ,
    "day"             : "27" ,
    "weekday"         : "4" ,
    "hour"            : "12" ,
    "minute"          : "00" ,
    "textColor"       : "#000000" ,
    "backgroundColor" : "#EFEFEF" ,
    "borderColor"     : "#EFEFEF" ,
  }
}
Editing events in the organizer
Don't forget to activate the following parameters in the API settings of the key.
[subtype] update
URL: http://domainname.crma.pro:81/sharedapi/org_events/update
Params:
Parameters are mostly the same as those for adding, with a few following exceptions:
- add ID - ID of the event edited to array "event"
- you can get only those parameters that need to be edited
- you can skip parameter "users", if the list of participants does not change
- you can specify parameter"publ" = "0" for deletion, "1" - for recovery (requires the relevant access permission)
users - array with the info about event participants
key - user ID
values: "simple" - regular, "root" - moderator (initiator)
Response
event - info about event (same as when creating event)
Deleting events in the organizer
Don't forget to activate the following parameters in the API settings of the key.
[subtype] delete
URL: http://domainname.crma.pro:81/sharedapi/org_events/delete
Params:
id - reminder ID
Response
event - info about event (same as when creating event)
In order to enable Webhook, you need to have business processes activated.
After setting the URL and selecting the events you want to subscribe to, a "post" request containing the parameters of the CRM event is sent to the url in real time mode.
The body of the post request contains an array of data in JSON format. The general outlook of the array is as follows: {
  "subject_type" : "employee",
  "subject_type_id" : "2",
  "event" : "create",
  "object_typ" : "customer",
  "object_sub_type" : "0",
  "object_sub_id" : "10443",
  "snapshot" : [],
  "merge" : []
}
You can find a sample script for Webhook processing in PHP samples on Github (example/webhook.php)
subject_type - event initiator
subject_type_id - event initiator ID
event - event type
object_type - object involved in the event
object_sub_type - subtype of the object involved
object_sub_id - event object ID
snapshot - array of current object properties
merge - array of changes in object properties
When object properties are changed, the former property values are rendered in this array. Array format: {
  "name" : {
    "type" : "edit",
    "value" : "John",
  },
  1207 : {
    "type" : "edit",
    "value" : "100000",
  }
}
Array key is a variable field. If the key is an entry - it becomes a basic field, if the key is a number - it becomes an additional field.
  • business - business process
  • system - system
  • employee - user
  • login - system entry
  • view - viewing
  • create - creating
  • edit - editing
  • delete - deleting
  • export - data export
  • import - data import
  • status - change of status/stage
  • stage - change of status/stage
  • comment - new comment
  • manager - change of supervisor
  • answer - response to reminder question
  • messenger - new message
  • queue - assortment
  • other - other
  • customer - contacts
  • request - activities
  • stock - objects
  • sale - deals
  • task - tasks
  • messenger - messages (individual, group)
  • remind - reminders
  • email - email
  • emailsystem - email
  • call - call
  • sms - SMS
  • delivery - campaign
  • comment - comment
  • blank - document
  • app - attachment
"Snapshot" array comprises: {
  //object ID
  "id" : "10443",
  //initiator ID
  "author" : "2",
  //ID of CRM group
  "group_id" : "0",
  //first name
  "name" : "Michael",
  //last name
  "surname" : "Wildes",
  //patronymic
  "patronymic" : "",
  //supervisor
  "manager_id" : "2",
      //list of email addresses
      email: [
        {
          mail: "customer@gmail.com",
          comment: ""
        }
      ],
      //list of phone numbers
      phone: [
        {
          phone: "1965 XXX 4332",
          comment: "Main"
        },
        {
          phone: "1423 XXX 2253",
          comment: "Second"
        }
      ],
  //creation date
  "create_date" : "2017-04-06 11:27:36",
  //comment
  "comment" : "",
  //active
  "publish" : "1",
  //contact type
  "marktype" : "0",
  //private individual / legal entity
  "nattype" : "private_individual",
  //fields
  "extproperty" : [
    1246 : {
      "id" : "1246",
      "type" : "text",
      "value" : ""
    }
  ]
}
"Snapshot" array comprises: {
  //activity ID
  "request_id" : "455",
  //activity date
  "request_date" : "2017-03-27 16:56:33",
  //comment
  "request_comment" : "",
  //supervisor ID
  "manager" : "2",
  //contact
  "customer" : "10431",
  //email address
  "email" : [
    {
      "mail" : "test@test.com",
      "comment" : ""
    }
  ]
  //activity status
  "status" : "unselected",
  //type of activity
  "request_type" : "8",
  //activity
  "publish" : "1",
  //initiator
  "employee_creator_id" : "2",
  //list of additional supervisors
  "shared_managers" : []
  //fields
  "extproperty" : [
    1246 : {
      "id" : "1246",
      "type" : "text",
      "value" : ""
    }
  ]
}
"Snapshot" array comprises: {
  //object ID
  "id" : "536927",
  //ID of CRM group
  "group_id" : "0",
  //ID of objects category
  "parent" : "19",
  //name of objects category
  "parentname" : "Sale",
  //name
  "name" : "commercial sale: 23, Phoenix St.
  //quantity
  "count" : "1",
  //creation date
  "date_add" : "2017-04-05 16:00:29",
  //active
  "publish" : "1",
  //copy / associated with group of objects
  "copy" : "0",
  //type of object
  "type" : "2",
  //name of object type
  "typename" : "Commercial property",
  //type of last event involving the object
  "stock_activity_type" : "edit",
  //date of last event involving the object
  "stock_activity_date" : "2017-04-05 16:19:54",
  //object associated to contact
  "associated_with_customer" : "",
  //initiator
  "stock_creator_id" : "0   //list of additional supervisors
  "shared_managers" : []
  //fields
  "extproperty" : [
    1246 : {
      "id" : "1246",
      "type" : "text",
      "value" : ""
    }
  ]
}
"Snapshot" array comprises: {
  //deal ID
  "id" : "160",
  //contact ID
  "customers_id" : "10444",
  //supervisor ID
  "employee_id" : "2",
  //date of deal
  "date_create" : "2017-04-06 15:24:57",
  //deal type ID
  "sales_type_id" : "4",
  //deal type name
  "sales_type_name" : "Matching for sale and assisting on sale",
  //deal status
  "sales_status_id" : "14",
  //name of deal status
  "sales_status_name" : "Preliminary agreement",
  //comment
  "comment" : "",
  //price
  "price" : "",
  //activated / deleted
  "publish" : "1",
  //contact's first name
  "customer_name" : "Retail sales",
  //contact's last name
  "customer_surname" : "",
  //contact's patronymic
  "customer_patronymic" : "",
  //contact's email address
  "customer_email" : "",
  //type of latest event involving the deal
  "sale_activity_type" : "create",
  //date of latest event involving the deal
  "sale_activity_date" : "0000-00-00 00:00:00",
  //deal initiator
  "sale_creator_id" : "2"
  //list of additional supervisors
  "shared_managers" : []
  //fields
  "extproperty" : [
    1246 : {
      "id" : "1246",
      "type" : "text",
      "value" : ""
    }
  ]
}
"Snapshot" array comprises: {
  //ID of email to contact
  "id" : "17",
  //campaign ID
  "delivery_id" : "10",
  //ID of subscribers group
  "group_id" : "1",
  //SMTP account ID
  "smtp_id" : "1",
  //contact
  "customer_id" : "0",
  //recipient email
  "email" : "test@test.com",
  //recipient reference
  "url" : "54f12091099d5c5c4cd9b055504df2c9",
  //email status
  "status" : "open",
  //date of latest change
  "date_change" : "2017-04-06 15:57:12",
  //log of changes
  "log" : {,
    //status
    "res" : "1",
    "stat" : "1",
    //description of error
    "error" : "",
    //date
    "date_send" : "2017-04-06 03:51:52",
    //list of dates when email was opened
    "check" : [
      "2017-04-06 16:01:34"
    ]",
  ]
  //ID of email to contact
  "letter_id" : "17
}
"Snapshot" array comprises: {
  "id" : "33902",
  "date_time" : "2017-04-06 12:42:20",
  "apro_crm_user" : "79",
  "parent_type" : "direct_call",
  "parent_id" : "79",
  "call_to_type" : "crm_client",
  "call_to_id" : "60046",
  "call_id" : "4837780ff331a99d3ff76e5f7abd55cd",
  "scenario_id" : "0",
  "call_duration" : "0",
  "call_cost" : "0.00000",
  "trunk_id" : "7",
  "caller_id" : "74952255024",
  "from_number" : "108",
  "to_number" : "79379840000",
  "vox_login" : "login",
  "url" : "http://test.com",
  "path" : "",
  "is_downloaded" : "0",
  "answered" : "-1",
  "voicemessage" : "0",
  "fax" : "0",
  "fax_status" : "0",
  "custom_status" : "0",
  "payload" : "",
  "api_incoming" : "0",
  "is_cached" : "0",
  "record_download" : "",
  "record_play" : ""
}
"Snapshot" array for creation and viewing comprises: {
  "id" : "2536",
  "type" : "standard",
  "autor_id" : "2",
  "autor_type" : "user",
  "created_on" : "2017-04-07 09:53:00",
  "edited_at" : "2017-04-07 10:11:17",
  "terms" : "2017-04-30 00:00:00",
  "title" : "Task title",
  "description" : "Call your clients about their birthday",
  "status" : "new",
  "priority" : "2",
  "sms" : "0",
  "room" : "",
  "external" : "0",
  "last_change" : "edit",
  "changer_id" : "2",
  "changer_type" : "user",
  "change_date" : "2017-04-07 10:11:17",
  "description_rev" : "3",
  "parent_task_id" : "0",
  "terms_pset" : "0",
  "files" : [
    {
      "id" : "8790",
      "type" : "task",
      "title" : "Text of congratulation.txt"
    }
  ],
  "users" : [
    {
    "id" : "2",
    "type" : "director",
    "name" : "admin",
    "surname" : "admin",
    "patronymic" : "admin"
    },
    {
    "id" : "6",
    "type" : "co-executive",
    "name" : "David",
    "surname" : "Mills",
    "patronymic" : "",
    },
    {
    "id" : "8",
    "type" : "executive",
    "name" : "Alexandra",
    "surname" : "Rhodes",
    "patronymic" : "",
    }
  ],
  "history" : [
    {
    "task_id" : "2536",
    "change_type" : "edit",
    "change_arg0" : "3",
    "status_from" : "new",
    "status_to" : "new",
    "date" : "2017-04-07 10:11:17",
    "prev_terms" : "0000-00-00 00:00:00",
    "changer_id" : "2",
    "changer_type" : "employee"
    }
  "],
  "tags" : {
    "existTags" : []
    "taskTags" : []
  }
}
"Snapshot" array for changing status comprises: {
  "action" : "change_status",
  "data" : {
    "task_id" : "2536",
    "changer_type" : "employee",
    "changer_id" : "2",
    "status_from" : "new",
    "status_to" : "frozen"
  }
}
"Snapshot" array for creation and viewing comprises: {
  // template ID
  "blank" : "74",
  // title
  "title" : "",
  "filledtype" : "shared",
  // document fields
  "extfields" : [
    {
    "ext" : "1195",
    "data" : "text",
    "value" : "533 Pritchard Court",
    }
  // document text
  "fish" : "Document filled",
  "object_type" : "customer",
  "object_id" : "0",
  // template reference
  "hash" : "493b333b7d21f1ba344c3508bfa0edc9",
  // document ID
  "id" : "115"
}