{"_id":"5a305118c8392b0032f6ae16","category":{"_id":"5a305118c8392b0032f6ae09","version":"5a305118c8392b0032f6ae07","project":"5425e663ffd4411c319a65b4","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-09-29T20:18:57.785Z","from_sync":false,"order":1,"slug":"reference","title":"Reference"},"user":"5425e31affd4411c319a65b1","project":"5425e663ffd4411c319a65b4","version":{"_id":"5a305118c8392b0032f6ae07","project":"5425e663ffd4411c319a65b4","__v":1,"createdAt":"2017-12-12T21:58:48.080Z","releaseDate":"2017-12-12T21:58:48.080Z","categories":["5a305118c8392b0032f6ae08","5a305118c8392b0032f6ae09"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.6.0","version":"2.6"},"githubsync":"","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-09-30T20:41:19.937Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"never","params":[],"url":""},"isReference":false,"order":4,"body":"Teams are named entities that bring together administrators and workers belonging to the same organization. Teams have hubs from where its workers may start and end their shifts.\n[block:api-header]\n{\n  \"type\": \"post\",\n  \"title\": \"Create team\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"name\",\n    \"1-0\": \"workers\",\n    \"2-0\": \"managers\",\n    \"3-0\": \"hub\",\n    \"0-1\": \"string\",\n    \"1-1\": \"string array\",\n    \"2-1\": \"string array\",\n    \"3-1\": \"string\",\n    \"0-2\": \"A unique name for the team.\",\n    \"1-2\": \"An array of worker IDs.\",\n    \"2-2\": \"An array of managing administrator IDs.\",\n    \"3-2\": \"Optional. The ID of the team's hub.\"\n  },\n  \"cols\": 3,\n  \"rows\": 4\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ curl -X POST \\\"https://onfleet.com/api/v2/teams\\\" \\\\\\n       -u \\\"cd3b3de84cc1ee040bf06512d233719c:\\\" \\\\\\n       -d '{\\\"name\\\":\\\"Sunset\\\",\\\"workers\\\":[\\\"1LjhGUWdxFbvdsTAAXs0TFos\\\",\\\"F8WPCqGmQYWpCkQ2c8zJTCpW\\\"],\\\"managers\\\":[\\\"Mrq7aKqzPFKX22pmjdLx*ohM\\\"],\\\"hub\\\":\\\"tKxSfU7psqDQEBVn5e2VQ~*O\\\"}'\",\n      \"language\": \"curl\",\n      \"name\": \"Request\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"id\\\": \\\"FFqPs1KHayxorfA~~xIj0us4\\\",\\n  \\\"timeCreated\\\": 1455156655000,\\n  \\\"timeLastModified\\\": 1455156655647,\\n  \\\"name\\\": \\\"Sunset\\\",\\n  \\\"workers\\\": [\\n    \\\"1LjhGUWdxFbvdsTAAXs0TFos\\\",\\n    \\\"F8WPCqGmQYWpCkQ2c8zJTCpW\\\"\\n  ],\\n  \\\"managers\\\": [\\n    \\\"Mrq7aKqzPFKX22pmjdLx*ohM\\\"\\n  ],\\n  \\\"hub\\\": \\\"tKxSfU7psqDQEBVn5e2VQ~*O\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response\"\n    },\n    {\n      \"code\": \"{\\n  \\\"code\\\": \\\"InvalidArgument\\\",\\n  \\\"message\\\": {\\n    \\\"error\\\": 1901,\\n    \\\"message\\\": \\\"One or more parameters required for this request must be unique but are not unique.\\\",\\n    \\\"cause\\\": \\\"Name is not unique within org\\\",\\n    \\\"request\\\": \\\"1adcce4a-e172-4868-a53f-2741a9157caf\\\"\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Error - Duplicate Team Name\"\n    },\n    {\n      \"code\": \"{\\n  \\\"code\\\": \\\"InvalidContent\\\",\\n  \\\"message\\\": {\\n    \\\"error\\\": 1000,\\n    \\\"message\\\": \\\"The values of one or more parameters are invalid.\\\",\\n    \\\"request\\\": \\\"0283a417-e7c0-47f7-90c7-86036e47afa6\\\"\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Error - Invalid Content\"\n    }\n  ]\n}\n[/block]\nAs team names are unique within each organization, errors will be thrown if a duplicate name is used.\n[block:api-header]\n{\n  \"type\": \"put\",\n  \"title\": \"Update team\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ curl -X PUT \\\"https://onfleet.com/api/v2/teams/FFqPs1KHayxorfA~~xIj0us4\\\" \\\\\\n       -u \\\"cd3b3de84cc1ee040bf06512d233719c:\\\" \\\\\\n       -d '{\\\"workers\\\":[\\\"1LjhGUWdxFbvdsTAAXs0TFos\\\",\\\"F8WPCqGmQYWpCkQ2c8zJTCpW\\\",\\\"3joS0Jh19VpJZgSTxFOK9fTf\\\"]}'\",\n      \"language\": \"shell\",\n      \"name\": \"Request\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"id\\\": \\\"FFqPs1KHayxorfA~~xIj0us4\\\",\\n  \\\"timeCreated\\\": 1455156655000,\\n  \\\"timeLastModified\\\": 1455156656399,\\n  \\\"name\\\": \\\"Sunset\\\",\\n  \\\"workers\\\": [\\n    \\\"1LjhGUWdxFbvdsTAAXs0TFos\\\",\\n    \\\"F8WPCqGmQYWpCkQ2c8zJTCpW\\\",\\n    \\\"3joS0Jh19VpJZgSTxFOK9fTf\\\"\\n  ],\\n  \\\"managers\\\": [\\n    \\\"Mrq7aKqzPFKX22pmjdLx*ohM\\\"\\n  ],\\n  \\\"hub\\\": \\\"tKxSfU7psqDQEBVn5e2VQ~*O\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response\"\n    },\n    {\n      \"code\": \"{\\n  \\\"code\\\": \\\"ResourceNotFound\\\",\\n  \\\"message\\\": {\\n    \\\"error\\\": 1402,\\n    \\\"message\\\": \\\"The requested resource does not exist.\\\",\\n    \\\"request\\\": \\\"517e4611-44f0-40de-a0f9-c306884de7e0\\\"\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Error - Team Not Found\"\n    },\n    {\n      \"code\": \"{\\n  \\\"code\\\": \\\"InvalidContent\\\",\\n  \\\"message\\\": {\\n    \\\"error\\\": 1000,\\n    \\\"message\\\": \\\"The values of one or more parameters are invalid.\\\",\\n    \\\"cause\\\": \\\"Invalid managers or workers for team\\\",\\n    \\\"request\\\": \\\"9e2a8dd7-9513-4a5c-b7f7-994796b3615b\\\"\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Error - Invalid Contents\"\n    }\n  ]\n}\n[/block]\nWhen attempting to update a team's information, ensure that the worker and manager resources exist within your organization. Otherwise, errors will be thrown as invalid managers or workers.\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"List teams\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ curl -X GET \\\"https://onfleet.com/api/v2/teams\\\" \\\\\\n       -u \\\"cd3b3de84cc1ee040bf06512d233719c:\\\"\",\n      \"language\": \"shell\",\n      \"name\": \"Request\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[\\n  {\\n    \\\"id\\\": \\\"yKpCnWprM1Rvp3NGGlVa5TMa\\\",\\n    \\\"timeCreated\\\": 1455048584000,\\n    \\\"timeLastModified\\\": 1455049756016,\\n    \\\"name\\\": \\\"FiDi\\\",\\n    \\\"workers\\\": [\\n      \\\"1LjhGUWdxFbvdsTAAXs0TFos\\\"\\n    ],\\n    \\\"managers\\\": [\\n      \\\"Mrq7aKqzPFKX22pmjdLx*ohM\\\"\\n    ],\\n    \\\"hub\\\": null,\\n    \\\"tasks\\\": [\\n      \\\"bKD0XoVZNFyBlE1rB~xvAdvp\\\"\\n    ]\\n  },\\n\\t// ...\\n  {\\n    \\\"id\\\": \\\"R4P7jhuzaIZ4cHHZE1ghmTtB\\\",\\n    \\\"timeCreated\\\": 1455048567000,\\n    \\\"timeLastModified\\\": 1455073711646,\\n    \\\"name\\\": \\\"Tenderloin\\\",\\n    \\\"workers\\\": [\\n      \\\"h*wSb*apKlDkUFnuLTtjPke7\\\",\\n      \\\"3joS0Jh19VpJZgSTxFOK9fTf\\\"\\n    ],\\n    \\\"managers\\\": [\\n      \\\"9ZGGl3R~T7lXxZOuOkZwuaPf\\\"\\n    ],\\n    \\\"hub\\\": \\\"E4s6bwGpOZp6pSU3Hz*2ngFA\\\",\\n    \\\"tasks\\\": [\\n      \\\"fYevkkuxafYOGNI0hGRwNm2t\\\"\\n    ]\\n  }\\n]\",\n      \"language\": \"json\",\n      \"name\": \"Response\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"Get single team\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ curl -X GET \\\"https://onfleet.com/api/v2/teams/9dyuPqHt6kDK5JKHFhE0xihh\\\" \\\\\\n       -u \\\"cd3b3de84cc1ee040bf06512d233719c:\\\"\",\n      \"language\": \"shell\",\n      \"name\": \"Request\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"id\\\": \\\"9dyuPqHt6kDK5JKHFhE0xihh\\\",\\n  \\\"timeCreated\\\": 1455048578000,\\n  \\\"timeLastModified\\\": 1455049756002,\\n  \\\"name\\\": \\\"Nob Hill\\\",\\n  \\\"workers\\\": [\\n    \\\"C**JneR4Jgd49ujNp7WsDE9Z\\\",\\n    \\\"1LjhGUWdxFbvdsTAAXs0TFos\\\"\\n  ],\\n  \\\"managers\\\": [\\n    \\\"9ZGGl3R~T7lXxZOuOkZwuaPf\\\"\\n  ],\\n  \\\"hub\\\": null,\\n  \\\"tasks\\\": []\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response\"\n    },\n    {\n      \"code\": \"{\\n  \\\"code\\\": \\\"ResourceNotFound\\\",\\n  \\\"message\\\": {\\n    \\\"error\\\": 1402,\\n    \\\"message\\\": \\\"The requested resource does not exist.\\\",\\n    \\\"request\\\": \\\"3e9a508b-58dd-47ed-a821-7334edb2d243\\\"\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Error - Team Not Found\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"delete\",\n  \"title\": \"Delete team\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ curl -X DELETE \\\"https://onfleet.com/api/v2/teams/FFqPs1KHayxorfA~~xIj0us4\\\" \\\\\\n       -u \\\"cd3b3de84cc1ee040bf06512d233719c:\\\"\",\n      \"language\": \"shell\",\n      \"name\": \"Request\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HTTP/1.1 200 OK\",\n      \"language\": \"http\",\n      \"name\": \"Response\"\n    },\n    {\n      \"code\": \"{\\n  \\\"code\\\": \\\"ResourceNotFound\\\",\\n  \\\"message\\\": {\\n    \\\"error\\\": 1402,\\n    \\\"message\\\": \\\"The requested resource does not exist.\\\",\\n    \\\"request\\\": \\\"d3ab2738-ae59-48f0-96d7-d75d2a47cfdb\\\"\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Error - Team Not Found\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"teams","type":"basic","title":"Teams"}
Teams are named entities that bring together administrators and workers belonging to the same organization. Teams have hubs from where its workers may start and end their shifts. [block:api-header] { "type": "post", "title": "Create team" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Description", "0-0": "name", "1-0": "workers", "2-0": "managers", "3-0": "hub", "0-1": "string", "1-1": "string array", "2-1": "string array", "3-1": "string", "0-2": "A unique name for the team.", "1-2": "An array of worker IDs.", "2-2": "An array of managing administrator IDs.", "3-2": "Optional. The ID of the team's hub." }, "cols": 3, "rows": 4 } [/block] [block:code] { "codes": [ { "code": "$ curl -X POST \"https://onfleet.com/api/v2/teams\" \\\n -u \"cd3b3de84cc1ee040bf06512d233719c:\" \\\n -d '{\"name\":\"Sunset\",\"workers\":[\"1LjhGUWdxFbvdsTAAXs0TFos\",\"F8WPCqGmQYWpCkQ2c8zJTCpW\"],\"managers\":[\"Mrq7aKqzPFKX22pmjdLx*ohM\"],\"hub\":\"tKxSfU7psqDQEBVn5e2VQ~*O\"}'", "language": "curl", "name": "Request" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"id\": \"FFqPs1KHayxorfA~~xIj0us4\",\n \"timeCreated\": 1455156655000,\n \"timeLastModified\": 1455156655647,\n \"name\": \"Sunset\",\n \"workers\": [\n \"1LjhGUWdxFbvdsTAAXs0TFos\",\n \"F8WPCqGmQYWpCkQ2c8zJTCpW\"\n ],\n \"managers\": [\n \"Mrq7aKqzPFKX22pmjdLx*ohM\"\n ],\n \"hub\": \"tKxSfU7psqDQEBVn5e2VQ~*O\"\n}", "language": "json", "name": "Response" }, { "code": "{\n \"code\": \"InvalidArgument\",\n \"message\": {\n \"error\": 1901,\n \"message\": \"One or more parameters required for this request must be unique but are not unique.\",\n \"cause\": \"Name is not unique within org\",\n \"request\": \"1adcce4a-e172-4868-a53f-2741a9157caf\"\n }\n}", "language": "json", "name": "Error - Duplicate Team Name" }, { "code": "{\n \"code\": \"InvalidContent\",\n \"message\": {\n \"error\": 1000,\n \"message\": \"The values of one or more parameters are invalid.\",\n \"request\": \"0283a417-e7c0-47f7-90c7-86036e47afa6\"\n }\n}", "language": "json", "name": "Error - Invalid Content" } ] } [/block] As team names are unique within each organization, errors will be thrown if a duplicate name is used. [block:api-header] { "type": "put", "title": "Update team" } [/block] [block:code] { "codes": [ { "code": "$ curl -X PUT \"https://onfleet.com/api/v2/teams/FFqPs1KHayxorfA~~xIj0us4\" \\\n -u \"cd3b3de84cc1ee040bf06512d233719c:\" \\\n -d '{\"workers\":[\"1LjhGUWdxFbvdsTAAXs0TFos\",\"F8WPCqGmQYWpCkQ2c8zJTCpW\",\"3joS0Jh19VpJZgSTxFOK9fTf\"]}'", "language": "shell", "name": "Request" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"id\": \"FFqPs1KHayxorfA~~xIj0us4\",\n \"timeCreated\": 1455156655000,\n \"timeLastModified\": 1455156656399,\n \"name\": \"Sunset\",\n \"workers\": [\n \"1LjhGUWdxFbvdsTAAXs0TFos\",\n \"F8WPCqGmQYWpCkQ2c8zJTCpW\",\n \"3joS0Jh19VpJZgSTxFOK9fTf\"\n ],\n \"managers\": [\n \"Mrq7aKqzPFKX22pmjdLx*ohM\"\n ],\n \"hub\": \"tKxSfU7psqDQEBVn5e2VQ~*O\"\n}", "language": "json", "name": "Response" }, { "code": "{\n \"code\": \"ResourceNotFound\",\n \"message\": {\n \"error\": 1402,\n \"message\": \"The requested resource does not exist.\",\n \"request\": \"517e4611-44f0-40de-a0f9-c306884de7e0\"\n }\n}", "language": "json", "name": "Error - Team Not Found" }, { "code": "{\n \"code\": \"InvalidContent\",\n \"message\": {\n \"error\": 1000,\n \"message\": \"The values of one or more parameters are invalid.\",\n \"cause\": \"Invalid managers or workers for team\",\n \"request\": \"9e2a8dd7-9513-4a5c-b7f7-994796b3615b\"\n }\n}", "language": "json", "name": "Error - Invalid Contents" } ] } [/block] When attempting to update a team's information, ensure that the worker and manager resources exist within your organization. Otherwise, errors will be thrown as invalid managers or workers. [block:api-header] { "type": "get", "title": "List teams" } [/block] [block:code] { "codes": [ { "code": "$ curl -X GET \"https://onfleet.com/api/v2/teams\" \\\n -u \"cd3b3de84cc1ee040bf06512d233719c:\"", "language": "shell", "name": "Request" } ] } [/block] [block:code] { "codes": [ { "code": "[\n {\n \"id\": \"yKpCnWprM1Rvp3NGGlVa5TMa\",\n \"timeCreated\": 1455048584000,\n \"timeLastModified\": 1455049756016,\n \"name\": \"FiDi\",\n \"workers\": [\n \"1LjhGUWdxFbvdsTAAXs0TFos\"\n ],\n \"managers\": [\n \"Mrq7aKqzPFKX22pmjdLx*ohM\"\n ],\n \"hub\": null,\n \"tasks\": [\n \"bKD0XoVZNFyBlE1rB~xvAdvp\"\n ]\n },\n\t// ...\n {\n \"id\": \"R4P7jhuzaIZ4cHHZE1ghmTtB\",\n \"timeCreated\": 1455048567000,\n \"timeLastModified\": 1455073711646,\n \"name\": \"Tenderloin\",\n \"workers\": [\n \"h*wSb*apKlDkUFnuLTtjPke7\",\n \"3joS0Jh19VpJZgSTxFOK9fTf\"\n ],\n \"managers\": [\n \"9ZGGl3R~T7lXxZOuOkZwuaPf\"\n ],\n \"hub\": \"E4s6bwGpOZp6pSU3Hz*2ngFA\",\n \"tasks\": [\n \"fYevkkuxafYOGNI0hGRwNm2t\"\n ]\n }\n]", "language": "json", "name": "Response" } ] } [/block] [block:api-header] { "type": "get", "title": "Get single team" } [/block] [block:code] { "codes": [ { "code": "$ curl -X GET \"https://onfleet.com/api/v2/teams/9dyuPqHt6kDK5JKHFhE0xihh\" \\\n -u \"cd3b3de84cc1ee040bf06512d233719c:\"", "language": "shell", "name": "Request" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"id\": \"9dyuPqHt6kDK5JKHFhE0xihh\",\n \"timeCreated\": 1455048578000,\n \"timeLastModified\": 1455049756002,\n \"name\": \"Nob Hill\",\n \"workers\": [\n \"C**JneR4Jgd49ujNp7WsDE9Z\",\n \"1LjhGUWdxFbvdsTAAXs0TFos\"\n ],\n \"managers\": [\n \"9ZGGl3R~T7lXxZOuOkZwuaPf\"\n ],\n \"hub\": null,\n \"tasks\": []\n}", "language": "json", "name": "Response" }, { "code": "{\n \"code\": \"ResourceNotFound\",\n \"message\": {\n \"error\": 1402,\n \"message\": \"The requested resource does not exist.\",\n \"request\": \"3e9a508b-58dd-47ed-a821-7334edb2d243\"\n }\n}", "language": "json", "name": "Error - Team Not Found" } ] } [/block] [block:api-header] { "type": "delete", "title": "Delete team" } [/block] [block:code] { "codes": [ { "code": "$ curl -X DELETE \"https://onfleet.com/api/v2/teams/FFqPs1KHayxorfA~~xIj0us4\" \\\n -u \"cd3b3de84cc1ee040bf06512d233719c:\"", "language": "shell", "name": "Request" } ] } [/block] [block:code] { "codes": [ { "code": "HTTP/1.1 200 OK", "language": "http", "name": "Response" }, { "code": "{\n \"code\": \"ResourceNotFound\",\n \"message\": {\n \"error\": 1402,\n \"message\": \"The requested resource does not exist.\",\n \"request\": \"d3ab2738-ae59-48f0-96d7-d75d2a47cfdb\"\n }\n}", "language": "json", "name": "Error - Team Not Found" } ] } [/block]