Teams

Get teams

GET /teams

Query string parameters

  • team_type string – Search for team type.
    • Can be dealer or agency
  • group_id integer - Filter by group id.
  • Supports Searching
  • Supports Pagination
  • Supports Sorting
    • Can be name, zip_code or city

Response
Status code 200

{
  "data": [
    {
      "id": 1,
      "name": "Team 1",
      "address_1": "Savannah 123",
      "address_2": "Under the tree on the left",
      "zip_code": "4730",
      "city": "Umzimkulu",
      "state": "KwaZulu-Natal",
      "country": null,
      "phone_number": "031 308 7900",
      "website": "https://easir.com",
      "vat": "somevatnumber",
      "team_type": null,
      "use_social_lookup": false,
      "created_at": "2014-01-01 12:45:56",
      "updated_at": "2014-01-02 00:11:22",
      "fields": [
        {
          "id": "862d0d34-419b-4203-a49a-0ca76bf8e2c2",
          "value": [
            "0fcb27ca-9d4e-4af7-9eec-c78acf23f64a"
          ]
        },
        {
          "id": "f729f55f-796e-4587-81f5-f35e1a5a707b",
          "value": [
            "d20b85e3-3834-4473-be6c-06b83e137e14"
          ]
        }
      ]
    }
  ],
  "pagination": {
    "total": 3,
    "page": 1,
    "per_page": 15,
    "urls": {
      "previous": null,
      "next": null
    }
  }
}

Get a team

GET /teams/:team_id

Response
Status code 200

{
  "id": 1,
  "name": "Team 1",
  "address_1": "Savannah 123",
  "address_2": "Under the tree on the left",
  "zip_code": "4730",
  "city": "Umzimkulu",
  "state": "KwaZulu-Natal",
  "country": {
    "name": "South Africa",
    "native_name": "South Africa",
    "code": "ZA"
  },
  "phone_number": "031 308 7900",
  "website": "https://easir.com",
  "vat": "somevatnumber",
  "team_type": null,
  "use_social_lookup": false,
  "timezone": {
    "name": "Africa/Johannesburg",
    "offset": 7200
  },
  "locale": {
    "code": "en-US",
    "language_name": "English",
    "country": {
      "name": "United States",
      "native_name": "United States",
      "code": "US"
    }
  },
  "fields": [
    {
      "id": "862d0d34-419b-4203-a49a-0ca76bf8e2c2",
      "value": [
        "0fcb27ca-9d4e-4af7-9eec-c78acf23f64a"
      ]
    },
    {
      "id": "f729f55f-796e-4587-81f5-f35e1a5a707b",
      "value": [
        "d20b85e3-3834-4473-be6c-06b83e137e14"
      ]
    }
  ],
  "created_at": "2014-01-01 12:45:56",
  "updated_at": "2014-01-02 00:11:22"
}

Create a team

POST /teams

Parameters

  • name string
    • Required
    • Maximum 100 characters
  • timezone.name string
  • address_1 string
    • Maximum 100 characters
  • address_2 string
    • Maximum 100 characters
  • zip_code string
    • Maximum 16 characters
  • city string
    • Maximum 60 characters
  • state string
    • Maximum 60 characters
  • country string
    • Must be a valid country code
  • phone_number string
    • Maximum 255 characters
  • website string
    • Must be a valid URL
    • Maximum 255 characters
  • vat string
    • Maximum 16 characters
  • locale.code string
  • team_type string - Used for Lead Management.
    • Can be agency, dealer, or null
  • use_social_lookup boolean - If the team is on the premium plan, do you want to use social lookup.
  • Supports Fields
    • Where ownerType is team

Deprecated parameters

  • timezone in favor of timezone.name
    • Removal: 2018/04/01
  • locale in favor of locale.code
    • Removal: 2018/04/01

Payload

{
  "name": "A new team",
  "timezone": {
    "name": "Europe/London"
  },
  "phone_number": "234543523",
  "website": "http://easir.com",
  "vat": "12343653214214",
  "address_1": "Some new address 1",
  "address_2": "Some new address 2",
  "zip_code": "654321",
  "state": "some state",
  "city": "A new city",
  "country": "GB",
  "locale": {
    "code": "en-GB"
  },
  "team_type": "agency",
  "use_social_lookup": false,
  "fields": [
    {
      "id": "862d0d34-419b-4203-a49a-0ca76bf8e2c2",
      "value": [
        "0fcb27ca-9d4e-4af7-9eec-c78acf23f64a"
      ]
    },
    {
      "id": "f729f55f-796e-4587-81f5-f35e1a5a707b",
      "value": [
        "d20b85e3-3834-4473-be6c-06b83e137e14"
      ]
    }
  ]
}

Response
Status code 201

{
  "id": 61,
  "name": "A new team",
  "address_1": "Some new address 1",
  "address_2": "Some new address 2",
  "zip_code": "654321",
  "city": "A new city",
  "state": "some state",
  "country": {
    "name": "United Kingdom",
    "native_name": "United Kingdom",
    "code": "GB"
  },
  "phone_number": "234543523",
  "website": "http:\/\/easir.com",
  "vat": "12343653214214",
  "timezone": {
    "name": "Europe\/London",
    "offset": 3600
  },
  "locale": {
    "code": "en-GB",
    "language_name": "English",
    "country": {
      "name": "United Kingdom",
      "native_name": "United Kingdom",
      "code": "GB"
    }
  },
  "fields": [
    {
      "id": "862d0d34-419b-4203-a49a-0ca76bf8e2c2",
      "value": [
        "0fcb27ca-9d4e-4af7-9eec-c78acf23f64a"
      ]
    },
    {
      "id": "f729f55f-796e-4587-81f5-f35e1a5a707b",
      "value": [
        "d20b85e3-3834-4473-be6c-06b83e137e14"
      ]
    }
  ],
  "team_type": "agency",
  "group_id": null,
  "use_social_lookup": false,
  "created_at": "2017-06-16 06:14:17",
  "updated_at": "2017-06-16 06:14:17"
}

Update a team

PUT /teams/:team_id

Parameters

Payload

{
  "name": "A new team - updated",
  "timezone": {
    "name": "Europe/London"
  },
  "phone_number": "234543523",
  "website": "http://easir.com",
  "vat": "12343653214214",
  "address_1": "Some new address 1",
  "address_2": "Some new address 2",
  "zip_code": "654321",
  "state": "some state",
  "city": "A new city",
  "country": "DE",
  "locale": {
    "code": "en-GB"
  },
  "team_type": "agency",
  "use_social_lookup": false,
  "fields": [
    {
      "id": "862d0d34-419b-4203-a49a-0ca76bf8e2c2",
      "value": [
        "0fcb27ca-9d4e-4af7-9eec-c78acf23f64a"
      ]
    },
    {
      "id": "f729f55f-796e-4587-81f5-f35e1a5a707b",
      "value": [
        "d20b85e3-3834-4473-be6c-06b83e137e14"
      ]
    }
  ]
}

Response
Status code 200

{
  "id": 11,
  "name": "A new team - updated",
  "address_1": "Some new address 1",
  "address_2": "Some new address 2",
  "zip_code": "654321",
  "city": "A new city",
  "state": "some state",
  "country": {
    "name": "Germany",
    "native_name": "Deutschland",
    "code": "DE"
  },
  "phone_number": "234543523",
  "website": "http://easir.com",
  "vat": 12343653214214,
  "timezone": {
    "name": "Europe/London",
    "offset": 0
  },
  "locale": {
    "code": "en-GB",
    "language_name": "English",
    "country": {
      "name": "United Kingdom",
      "native_name": "United Kingdom",
      "code": "GB"
    }
  },
  "fields": [
    {
      "id": "862d0d34-419b-4203-a49a-0ca76bf8e2c2",
      "value": [
        "0fcb27ca-9d4e-4af7-9eec-c78acf23f64a"
      ]
    },
    {
      "id": "f729f55f-796e-4587-81f5-f35e1a5a707b",
      "value": [
        "d20b85e3-3834-4473-be6c-06b83e137e14"
      ]
    }
  ],
  "team_type": "agency",
  "use_social_lookup": false,
  "created_at": "2015-02-24 07:54:10",
  "updated_at": "2015-02-24 07:55:40"
}

Delete a team

DELETE /teams/:team_id

Response
Status code 204

Attach user to a team

PUT /teams/:team_id/users/:user_id

Response
Status code 204

Detach user from a team

DELETE /teams/:team_id/users/:user_id

Response
Status code 204

Find users in team

GET /teams/:team_id/users

Query string parameters

Response
Status code 200

{
  "data": [
    {
      "id": 1,
      "first_name": "Doe",
      "last_name": "John",
      "phone_number": "+4588888888",
      "job_title": "Animal",
      "email": "info@easir.com",
      "profile_picture": "http://cdn.cutestpaw.com/wp-content/uploads/2013/06/l-Baby.jpeg",
      "timezone": {
        "name": "Europe/Copenhagen",
        "offset": 3600
      },
      "team": {
        "id": 1,
        "name": "Team 1",
        "address_1": "Savannah 123",
        "address_2": "Under the tree on the left",
        "zip_code": "4730",
        "city": "Umzimkulu",
        "state": "KwaZulu-Natal",
        "country": null,
        "phone_number": "031 308 7900",
        "website": "https://easir.com",
        "vat": "1234567890123456",
        "team_type": "agency",
        "created_at": "2014-01-01 12:45:56",
        "updated_at": "2014-01-02 00:11:22"
      },
      "created_at": "2014-01-01 12:45:56",
      "updated_at": "2014-01-02 00:11:22"
    }
  ],
  "pagination": {
    "total": 1,
    "page": 1,
    "per_page": 15,
    "urls": {
      "previous": null,
      "next": null
    }
  }
}