The following macros are not currently supported in the header:
  • style

GET /companies

Returns an array of companies

GET /companies

Modified Date Inaccuracies

The date modified field and filters may return inaccurate and miss-leading results. Date modified constitutes any update or save to a company object. Please use with caution.

Parameters

Table of allowed parameters.

_pageunsigned intThe page of the list to display. For example, 5 will display the fifth page. Each page contains 10 resources.
_limitunsigned intThe maximum number of resources to return. Default is 10 and maximum is 50.
_offsetunsigned intThe position in the list of resources to return from. For example, if you had 20 resources and requested an offset of 10. Resources 10 to 19 would be returned. Offset cannot be used in conjunction with _page.
_fieldspartial stringAllows you to specify optional fields and linked objects to include in the response.
_searchstringAllows you to search for a company (searches website and name)

Filters

Companies filters can be used to easily filter through your company lists.

KEYEXAMPLEDESCRIPTION
date_modified_beforedate_modified_before(1341281246)Unix Timestamp. e.g 1341281246- Filter out companies that were not modified before this date.
date_modified_afterdate_modified_after(1341281246)Unix Timestamp. e.g 1341281246- Filter out companies that were not modified after this date.
date_created_beforedate_created_before(1341281246)Unix Timestamp. e.g 1341281246- Filter out companies that were not created before this date.
date_created_afterdate_created_after(1341281246)Unix Timestamp. e.g 1341281246- Filter out companies that were not created after this date.
manager_idmanager_id(124,32,43)Array of number. e.g 13,10,15- Filter out companies that do not have a manager with supplied manager id.
faxfax(44445555,55554444)Only return companies with matching fax number(s).
phonephone(44445555,55554444)Only return companies with matching phone number(s).
contact_numbercontact_number(44445555,55554444)Only return companies having a phone or fax matching one of the supplied phone numbers.
default_affiliationdefault_affiliation(12,32,56)Only return companies with given default affiliation id(s).
postal_addresspostal_address(12,43,54)Only return companies with given postal addresses.
idid(1,2,3)Only return companies with given id(s)
standingstanding(inactive)Only return companies with given standing(s)
statusstatus(12,34)Only return companies with given company status id(s)
max_idmax_id(12)Only return companies with id less or equal to max_id
min_idmin_id(342)Only return companies with id greater or equal to min_id

NEW

order_by_asc(<type>), order_by_desc(<type>)

 

_filters=order_by_desc(id)

Accepts: id, date_created, date_modified, date_last_interacted

name, standing and status

NEW

<field_name>_greater_than(<value>),

<field_name>_less_than(<value>),

<field_name>_greater_than_or_equal(<value>),

<field_name>_less_than_or_equal(<value>)

 

_filters=id_greater_than(5)

Available fields:

id
affiliation
country
status

NOTE: fax, phone and contact_number filters ignore whitespace.

Using the _not suffix (e.g, id_not) on standard in filters will return results not in.

The following sample will return companies created before Tue, 03 Jul 2012 02:07:26 GMT< that have a manager with an id 10, 11 or 100.

GET /companies?_filters=date_created_before(1341281246),manager_id(10,11,100)

Handling the response

Below is a table of available response fields and objects that are returned within the response object of the returned object. The optional fields and objects can be requested in the _fields parameter; see included examples. Underlined values are default.

idunsigned int 
namestring 
websitestring 
standingstring 
statusunsigned int or object 
phonestring 
faxstring 
date_createdunsigned int 
date_modifiedunsigned int 
commentsstring 
contactunsigned int or object 

Fields that can be object indicate the field can be requested as a resource. For example.

GET /companies.json?_fields=contact

would return the contacts id. Where as,

GET /companies.json?_fields=contact()

would return the contact's object, including any optional fields or objects within the parenthesis.

Sample Response

GET /companies.json?_fields=contact(),standing&_limit=2
{
   "response" : [
      {
         "name" : "ADTOA",
         "contact" : {
            "email" : "rpepper@ihug.com.au",
            "firstname" : "Ronald",
            "id" : "1",
            "mobile" : "0425 239 666",
            "surname" : "Pepper IHUG"
         },
         "standing" : "active",
         "id" : "1"
      },
      {
         "name" : "Balgownie Veterinary Hospital",
         "contact" : {
            "email" : "mark@balgownievet.com.au",
            "firstname" : "Mark",
            "id" : "2",
            "mobile" : "",
            "surname" : "Allison"
         },
         "standing" : "active",
         "id" : "2"
      }
   ],
   "meta" : {
      "more_info" : "/public_api/docs/status/ok",
      "status" : "ok",
      "message" : "Everything executed as expected."
   }
}