Companies

Company endpoints allow for querying or updating of Company data within CMap


Get Company

HTTP GET v1/Companies/5

Returns the company with the matching id (if that company exists)

Response

{ 
	"id" : "23423",
	"name" : "Smith Industries",
	"telephone" : "01625 521 000",
	"website" : "http://www.smithindustries.com",
	"fax" : "01625 521 001",
	"notes" : "Some information about this company",
	"address" : "1 Hope Street, Manchester, M22 4TG" 
}

Get Companies

HTTP GET v1/Companies

Returns all companies belonging to the client

Response

[
  {
    "id": "876876",
    "name": "Smith Industries"
  }
]

Get Companies By Query

GET v1/Companies?q=[query]

Returns all companies that match the search query

Response

[
  {
    "id": "876876",
    "name": "Smith Industries"
  },
  {
    "id": "3345345",
    "name": "Smith Corp."
  }
]

Get Company Addresses

GET v1/Companies/5/Addresses

Returns all addresses associated with a company

Response

[
  {
    "AddressID": 32432,
    "Description": "Manchester Headquarters",
    "Address1": "5 Hope Street",
    "Address2": "",
    "Address3": "",
    "TownCity": "Manchester",
    "CountyState": "Greater Manchester",
    "Postcode": "M22 4TG"
  }
]

Create Company

HTTP POST v1/Companies/

Creates the Company and returns the Id

Request

{
  "name": "Smith Industries",
  "telephone": "01625 521 000",
  "website": "http://www.smithindustries.com",
  "fax": "01625 521 001",
  "paymentDays": "30",
  "notes": "Some information about this company",
  "addresses": [
    {
      "description": "HQ",
      "address1": "1 Hope Street",
      "address2": "",
      "address3": "",
      "townCity": "Manchester",
      "countyState": "Greater Manchester",
      "postcode": "M22 4TG"
    }
  ],
  "CustomFields": {
    "Text Field": "Some exciting text here",
    "Number Field": 4356,
    "Dropdown": "one",
    "Date Field": "2024-01-01",
    "Boolean": "Yes",
    "Dropdown Multi": [
      "Item 1",
      "Item 2"
    ],
    "User Field": "Jim Murphy",
    "User Multi": [
      "Jim Murphy",
      "Arthur Dent"
    ]
  }
}

Response

{
  "companyId": 12345
}

Update Company

HTTP PUT v1/Companies/

Updates the Company and returns the Id

Request

{
  "name": "Smith Industries",
  "telephone": "01625 521 000",
  "website": "http://www.smithindustries.com",
  "fax": "01625 521 001",
  "paymentDays": "30",
  "notes": "Some information about this company",
  "addresses": [
    {
      "description": "HQ",
      "address1": "1 Hope Street",
      "address2": "",
      "address3": "",
      "townCity": "Manchester",
      "countyState": "Greater Manchester",
      "postcode": "M22 4TG"
    }
  ],
  "CustomFields": {
    "Text Field": "Some exciting text here",
    "Number Field": 4356,
    "Dropdown": "one",
    "Date Field": "2024-01-01",
    "Boolean": "Yes",
    "Dropdown Multi": [
      "Item 1",
      "Item 2"
    ],
    "User Field": "Jim Murphy",
    "User Multi": [
      "Jim Murphy",
      "Arthur Dent"
    ]
  }
}

Response

{
  "companyId": 12345
}