Clients

Fields

Field Type Description Example
id string Client ID 1Q4L6Vm4ZphDJVkkc2Tgdw
name string Client's name John Smith
category Category Category {"id": "..."}
active bool Whether or not the client is active true
contactPerson string Contact person John Doe
address string Full address 1560 Broadway
lat float Latitude 40.75851758632223
lon float Longitude -73.98542266275206
email string Email contact@example.com
phone string Phone number +1 212-921-8900
team Team Team {"id": "..."}
zone Zone Zone {"id": "..."}
deliverySchedule list The delivery schedule [{"weekdays": [1, 2, 3, 4, 5], "fromTime": "09:00", "toTime": "18:00"}]
deliveryDuration int Delivery duration in seconds 300
files list Files attached to this client [{"id": "..."}]
requiredSkills list Skills required to deliver to this client [{"id": "..."}]

List clients

$ curl -H 'Authorization: Token ...' \
       -X GET \
       https://app.xfleet.io/api/v1/companies/{company}/clients
[
    {
        "name": "John Smith",
        "active": true,
        "contactPerson": "John Smith",
        "address": "Blvd. Sunset 30, NY",
        "lat": 40.75851758632223,
        "lon": -73.98542266275206,
        "email": "john.smith@example.com",
        "phone": "+1849498712",
        "deliverySchedule": [
            {
                "weekdays": [
                    1,
                    2,
                    3,
                    4,
                    5
                ],
                "fromTime": "09:00",
                "toTime": "18:00"
            }
        ],
        "createdAt": "2019-03-17T17:14:18+00:00",
        "id": "4DfX3YmztAvqupfPiqWgFQ",
        "notes": "Great customer!"
    }
]

Update a client

This performs partial updates on a given client.

curl \
    -X POST \
    -H 'Authorization: Token ...' \
    -H 'Content-Type: application/json' \
    -d '{"name": "mr. John Smith"}' \
   https://app.xfleet.io/api/v1/companies/{company}/clients/{id}
{
  "name": "mr. John Smith",
  "active": true,
  "contactPerson": "John Smith",
  "address": "Blvd. Sunset 30, NY",
  "lat": 40.75851758632223,
  "lon": -73.98542266275206,
  "email": "john.smith@example.com",
  "phone": "+1849498712",
  "deliverySchedule": [
    {
      "weekdays": [
        1,
        2,
        3,
        4,
        5
      ],
      "fromTime": "09:00",
      "toTime": "18:00"
    }
  ],
  "createdAt": "2019-03-17T17:14:18+00:00",
  "id": "4DfX3YmztAvqupfPiqWgFQ",
  "notes": "Great customer!"
}