aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/traccar/api/resource/SessionResource.java374
-rw-r--r--src/main/java/org/traccar/database/OpenIdProvider.java333
-rw-r--r--swagger.json7068
3 files changed, 3877 insertions, 3898 deletions
diff --git a/src/main/java/org/traccar/api/resource/SessionResource.java b/src/main/java/org/traccar/api/resource/SessionResource.java
index a20e5f100..8240a8a6f 100644
--- a/src/main/java/org/traccar/api/resource/SessionResource.java
+++ b/src/main/java/org/traccar/api/resource/SessionResource.java
@@ -1,186 +1,188 @@
-/*
- * Copyright 2015 - 2022 Anton Tananaev (anton@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.api.resource;
-
-import org.traccar.api.BaseResource;
-import org.traccar.api.security.LoginService;
-import org.traccar.api.signature.TokenManager;
-import org.traccar.database.OpenIdProvider;
-import org.traccar.helper.DataConverter;
-import org.traccar.helper.LogAction;
-import org.traccar.helper.ServletHelper;
-import org.traccar.model.User;
-import org.traccar.storage.StorageException;
-import org.traccar.storage.query.Columns;
-import org.traccar.storage.query.Condition;
-import org.traccar.storage.query.Request;
-
-import com.nimbusds.oauth2.sdk.ParseException;
-import javax.annotation.security.PermitAll;
-import javax.inject.Inject;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.net.URLDecoder;
-import java.nio.charset.StandardCharsets;
-import java.security.GeneralSecurityException;
-import java.util.Date;
-import java.net.URI;
-
-@Path("session")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
-public class SessionResource extends BaseResource {
-
- public static final String USER_ID_KEY = "userId";
- public static final String USER_COOKIE_KEY = "user";
- public static final String PASS_COOKIE_KEY = "password";
-
- @Inject
- private LoginService loginService;
-
- @Inject
- private OpenIdProvider openIdProvider;
-
- @Inject
- private TokenManager tokenManager;
-
- @Context
- private HttpServletRequest request;
-
- @PermitAll
- @GET
- public User get(@QueryParam("token") String token) throws StorageException, IOException, GeneralSecurityException {
-
- if (token != null) {
- User user = loginService.login(token);
- if (user != null) {
- request.getSession().setAttribute(USER_ID_KEY, user.getId());
- LogAction.login(user.getId(), ServletHelper.retrieveRemoteAddress(request));
- return user;
- }
- }
-
- Long userId = (Long) request.getSession().getAttribute(USER_ID_KEY);
- if (userId == null) {
-
- Cookie[] cookies = request.getCookies();
- String email = null, password = null;
- if (cookies != null) {
- for (Cookie cookie : cookies) {
- if (cookie.getName().equals(USER_COOKIE_KEY)) {
- byte[] emailBytes = DataConverter.parseBase64(
- URLDecoder.decode(cookie.getValue(), StandardCharsets.US_ASCII));
- email = new String(emailBytes, StandardCharsets.UTF_8);
- } else if (cookie.getName().equals(PASS_COOKIE_KEY)) {
- byte[] passwordBytes = DataConverter.parseBase64(
- URLDecoder.decode(cookie.getValue(), StandardCharsets.US_ASCII));
- password = new String(passwordBytes, StandardCharsets.UTF_8);
- }
- }
- }
- if (email != null && password != null) {
- User user = loginService.login(email, password);
- if (user != null) {
- request.getSession().setAttribute(USER_ID_KEY, user.getId());
- LogAction.login(user.getId(), ServletHelper.retrieveRemoteAddress(request));
- return user;
- }
- }
-
- } else {
-
- User user = permissionsService.getUser(userId);
- if (user != null) {
- return user;
- }
-
- }
-
- throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build());
- }
-
- @Path("{id}")
- @GET
- public User get(@PathParam("id") long userId) throws StorageException {
- permissionsService.checkUser(getUserId(), userId);
- User user = storage.getObject(User.class, new Request(
- new Columns.All(), new Condition.Equals("id", userId)));
- request.getSession().setAttribute(USER_ID_KEY, user.getId());
- LogAction.login(user.getId(), ServletHelper.retrieveRemoteAddress(request));
- return user;
- }
-
- @PermitAll
- @POST
- public User add(
- @FormParam("email") String email, @FormParam("password") String password) throws StorageException {
- User user = loginService.login(email, password);
- if (user != null) {
- request.getSession().setAttribute(USER_ID_KEY, user.getId());
- LogAction.login(user.getId(), ServletHelper.retrieveRemoteAddress(request));
- return user;
- } else {
- LogAction.failedLogin(ServletHelper.retrieveRemoteAddress(request));
- throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
- }
- }
-
- @DELETE
- public Response remove() {
- LogAction.logout(getUserId(), ServletHelper.retrieveRemoteAddress(request));
- request.getSession().removeAttribute(USER_ID_KEY);
- return Response.noContent().build();
- }
-
- @Path("token")
- @POST
- public String requestToken(
- @FormParam("expiration") Date expiration) throws StorageException, GeneralSecurityException, IOException {
- return tokenManager.generateToken(getUserId(), expiration);
- }
-
- @PermitAll
- @Path("openid/auth")
- @GET
- public Response openIdAuth() throws IOException {
- return Response.seeOther(openIdProvider.createAuthUri()).build();
- }
-
- @PermitAll
- @Path("openid/callback")
- @GET
- public Response requestToken() throws IOException, StorageException, ParseException, GeneralSecurityException {
- StringBuilder requestUrl = new StringBuilder(request.getRequestURL().toString());
- String queryString = request.getQueryString();
- String requestUri = requestUrl.append('?').append(queryString).toString();
-
- return Response.seeOther(openIdProvider.handleCallback(URI.create(requestUri), request)).build();
- }
-}
+/*
+ * Copyright 2015 - 2022 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.api.resource;
+
+import org.traccar.api.BaseResource;
+import org.traccar.api.security.LoginService;
+import org.traccar.api.signature.TokenManager;
+import org.traccar.database.OpenIdProvider;
+import org.traccar.helper.DataConverter;
+import org.traccar.helper.LogAction;
+import org.traccar.helper.ServletHelper;
+import org.traccar.model.User;
+import org.traccar.storage.StorageException;
+import org.traccar.storage.query.Columns;
+import org.traccar.storage.query.Condition;
+import org.traccar.storage.query.Request;
+
+import com.nimbusds.oauth2.sdk.ParseException;
+import javax.annotation.Nullable;
+import javax.annotation.security.PermitAll;
+import javax.inject.Inject;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
+import java.security.GeneralSecurityException;
+import java.util.Date;
+import java.net.URI;
+
+@Path("session")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
+public class SessionResource extends BaseResource {
+
+ public static final String USER_ID_KEY = "userId";
+ public static final String USER_COOKIE_KEY = "user";
+ public static final String PASS_COOKIE_KEY = "password";
+
+ @Inject
+ private LoginService loginService;
+
+ @Inject
+ @Nullable
+ private OpenIdProvider openIdProvider;
+
+ @Inject
+ private TokenManager tokenManager;
+
+ @Context
+ private HttpServletRequest request;
+
+ @PermitAll
+ @GET
+ public User get(@QueryParam("token") String token) throws StorageException, IOException, GeneralSecurityException {
+
+ if (token != null) {
+ User user = loginService.login(token);
+ if (user != null) {
+ request.getSession().setAttribute(USER_ID_KEY, user.getId());
+ LogAction.login(user.getId(), ServletHelper.retrieveRemoteAddress(request));
+ return user;
+ }
+ }
+
+ Long userId = (Long) request.getSession().getAttribute(USER_ID_KEY);
+ if (userId == null) {
+
+ Cookie[] cookies = request.getCookies();
+ String email = null, password = null;
+ if (cookies != null) {
+ for (Cookie cookie : cookies) {
+ if (cookie.getName().equals(USER_COOKIE_KEY)) {
+ byte[] emailBytes = DataConverter.parseBase64(
+ URLDecoder.decode(cookie.getValue(), StandardCharsets.US_ASCII));
+ email = new String(emailBytes, StandardCharsets.UTF_8);
+ } else if (cookie.getName().equals(PASS_COOKIE_KEY)) {
+ byte[] passwordBytes = DataConverter.parseBase64(
+ URLDecoder.decode(cookie.getValue(), StandardCharsets.US_ASCII));
+ password = new String(passwordBytes, StandardCharsets.UTF_8);
+ }
+ }
+ }
+ if (email != null && password != null) {
+ User user = loginService.login(email, password);
+ if (user != null) {
+ request.getSession().setAttribute(USER_ID_KEY, user.getId());
+ LogAction.login(user.getId(), ServletHelper.retrieveRemoteAddress(request));
+ return user;
+ }
+ }
+
+ } else {
+
+ User user = permissionsService.getUser(userId);
+ if (user != null) {
+ return user;
+ }
+
+ }
+
+ throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build());
+ }
+
+ @Path("{id}")
+ @GET
+ public User get(@PathParam("id") long userId) throws StorageException {
+ permissionsService.checkUser(getUserId(), userId);
+ User user = storage.getObject(User.class, new Request(
+ new Columns.All(), new Condition.Equals("id", userId)));
+ request.getSession().setAttribute(USER_ID_KEY, user.getId());
+ LogAction.login(user.getId(), ServletHelper.retrieveRemoteAddress(request));
+ return user;
+ }
+
+ @PermitAll
+ @POST
+ public User add(
+ @FormParam("email") String email, @FormParam("password") String password) throws StorageException {
+ User user = loginService.login(email, password);
+ if (user != null) {
+ request.getSession().setAttribute(USER_ID_KEY, user.getId());
+ LogAction.login(user.getId(), ServletHelper.retrieveRemoteAddress(request));
+ return user;
+ } else {
+ LogAction.failedLogin(ServletHelper.retrieveRemoteAddress(request));
+ throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
+ }
+ }
+
+ @DELETE
+ public Response remove() {
+ LogAction.logout(getUserId(), ServletHelper.retrieveRemoteAddress(request));
+ request.getSession().removeAttribute(USER_ID_KEY);
+ return Response.noContent().build();
+ }
+
+ @Path("token")
+ @POST
+ public String requestToken(
+ @FormParam("expiration") Date expiration) throws StorageException, GeneralSecurityException, IOException {
+ return tokenManager.generateToken(getUserId(), expiration);
+ }
+
+ @PermitAll
+ @Path("openid/auth")
+ @GET
+ public Response openIdAuth() throws IOException {
+ return Response.seeOther(openIdProvider.createAuthUri()).build();
+ }
+
+ @PermitAll
+ @Path("openid/callback")
+ @GET
+ public Response requestToken() throws IOException, StorageException, ParseException, GeneralSecurityException {
+ StringBuilder requestUrl = new StringBuilder(request.getRequestURL().toString());
+ String queryString = request.getQueryString();
+ String requestUri = requestUrl.append('?').append(queryString).toString();
+
+ return Response.seeOther(openIdProvider.handleCallback(URI.create(requestUri), request)).build();
+ }
+}
diff --git a/src/main/java/org/traccar/database/OpenIdProvider.java b/src/main/java/org/traccar/database/OpenIdProvider.java
index 6f44d0e80..22e5d6b50 100644
--- a/src/main/java/org/traccar/database/OpenIdProvider.java
+++ b/src/main/java/org/traccar/database/OpenIdProvider.java
@@ -1,170 +1,163 @@
-/*
- * Copyright 2023 Daniel Raper (me@danr.uk)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.database;
-
-import org.traccar.config.Config;
-import org.traccar.config.Keys;
-import org.traccar.api.resource.SessionResource;
-import org.traccar.api.security.LoginService;
-import org.traccar.model.User;
-import org.traccar.storage.StorageException;
-import org.traccar.helper.LogAction;
-import org.traccar.helper.ServletHelper;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.security.GeneralSecurityException;
-import java.io.IOException;
-import javax.servlet.http.HttpServletRequest;
-import com.google.inject.Inject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.nimbusds.oauth2.sdk.http.HTTPResponse;
-import com.nimbusds.oauth2.sdk.AuthorizationCode;
-import com.nimbusds.oauth2.sdk.ResponseType;
-import com.nimbusds.oauth2.sdk.Scope;
-import com.nimbusds.oauth2.sdk.AuthorizationGrant;
-import com.nimbusds.oauth2.sdk.TokenRequest;
-import com.nimbusds.oauth2.sdk.TokenResponse;
-import com.nimbusds.oauth2.sdk.AuthorizationCodeGrant;
-import com.nimbusds.oauth2.sdk.ParseException;
-import com.nimbusds.oauth2.sdk.AuthorizationResponse;
-import com.nimbusds.oauth2.sdk.auth.Secret;
-import com.nimbusds.oauth2.sdk.auth.ClientSecretBasic;
-import com.nimbusds.oauth2.sdk.auth.ClientAuthentication;
-import com.nimbusds.oauth2.sdk.token.BearerAccessToken;
-import com.nimbusds.oauth2.sdk.id.State;
-import com.nimbusds.oauth2.sdk.id.ClientID;
-import com.nimbusds.openid.connect.sdk.OIDCTokenResponse;
-import com.nimbusds.openid.connect.sdk.Nonce;
-import com.nimbusds.openid.connect.sdk.OIDCTokenResponseParser;
-import com.nimbusds.openid.connect.sdk.UserInfoResponse;
-import com.nimbusds.openid.connect.sdk.UserInfoRequest;
-import com.nimbusds.openid.connect.sdk.AuthenticationRequest;
-
-import com.nimbusds.openid.connect.sdk.claims.UserInfo;
-
-public class OpenIdProvider {
- private static final Logger LOGGER = LoggerFactory.getLogger(OpenIdProvider.class);
-
- public final Boolean force;
- private final ClientID clientId;
- private final ClientAuthentication clientAuth;
- private URI callbackUrl;
- private URI authUrl;
- private URI tokenUrl;
- private URI userInfoUrl;
- private URI baseUrl;
- private final String adminGroup;
-
- private LoginService loginService;
-
- @Inject
- public OpenIdProvider(Config config, LoginService loginService) {
- this.loginService = loginService;
-
- force = config.getBoolean(Keys.OPENID_FORCE);
- clientId = new ClientID(config.getString(Keys.OPENID_CLIENTID));
- clientAuth = new ClientSecretBasic(clientId, new Secret(config.getString(Keys.OPENID_CLIENTSECRET)));
-
- try {
- callbackUrl = new URI(config.getString(Keys.WEB_URL, "") + "/api/session/openid/callback");
- authUrl = new URI(config.getString(Keys.OPENID_AUTHURL, ""));
- tokenUrl = new URI(config.getString(Keys.OPENID_TOKENURL, ""));
- userInfoUrl = new URI(config.getString(Keys.OPENID_USERINFOURL, ""));
- baseUrl = new URI(config.getString(Keys.WEB_URL, ""));
- } catch(URISyntaxException error) {
- LOGGER.error("Invalid URIs provided in OpenID configuration");
- }
-
- adminGroup = config.getString(Keys.OPENID_ADMINGROUP);
- }
-
- public URI createAuthUri() {
- AuthenticationRequest request = new AuthenticationRequest.Builder(
- new ResponseType("code"),
- new Scope("openid", "profile", "email", "groups"),
- clientId,
- callbackUrl)
- .endpointURI(authUrl)
- .state(new State())
- .nonce(new Nonce())
- .build();
-
- return request.toURI();
- }
-
- private OIDCTokenResponse getToken(AuthorizationCode code) throws IOException, ParseException, GeneralSecurityException {
- AuthorizationGrant codeGrant = new AuthorizationCodeGrant(code, callbackUrl);
- TokenRequest tokenRequest = new TokenRequest(tokenUrl, clientAuth, codeGrant);
-
- HTTPResponse tokenReq = tokenRequest.toHTTPRequest().send();
- TokenResponse tokenResponse = OIDCTokenResponseParser.parse(tokenReq);
- if (!tokenResponse.indicatesSuccess()) {
- LOGGER.warn("Invalid authorization code provided to OpenID callback");
- throw new GeneralSecurityException("Unable to authenticate with the OpenID Connect provider.");
- }
-
- return (OIDCTokenResponse) tokenResponse.toSuccessResponse();
- }
-
- private UserInfo getUserInfo(BearerAccessToken token) throws IOException, ParseException, GeneralSecurityException {
- UserInfoResponse userInfoResponse;
-
- HTTPResponse httpResponse = new UserInfoRequest(userInfoUrl, token)
- .toHTTPRequest()
- .send();
-
- userInfoResponse = UserInfoResponse.parse(httpResponse);
-
- if (!userInfoResponse.indicatesSuccess()) {
- LOGGER.error("Failed to access OpenID user info endpoint");
- throw new GeneralSecurityException("Failed to access OpenID Connect user info endpoint. Please contact your administrator.");
- }
-
- return userInfoResponse.toSuccessResponse().getUserInfo();
- }
-
- public URI handleCallback(URI requestUri, HttpServletRequest request) throws StorageException, ParseException, IOException, GeneralSecurityException {
- AuthorizationResponse response = AuthorizationResponse.parse(requestUri);
-
- if (!response.indicatesSuccess()) {
- LOGGER.warn("Callback received error response from OpenID identity provider");
- throw new GeneralSecurityException(response.toErrorResponse().getErrorObject().getDescription());
- }
-
- AuthorizationCode authCode = response.toSuccessResponse().getAuthorizationCode();
-
- if (authCode == null) {
- LOGGER.warn("Malformed OpenID callback");
- throw new GeneralSecurityException( "Malformed OpenID callback.");
- }
-
- OIDCTokenResponse tokens = getToken(authCode);
-
- BearerAccessToken bearerToken = tokens.getOIDCTokens().getBearerAccessToken();
-
- UserInfo userInfo = getUserInfo(bearerToken);
-
- User user = loginService.login(userInfo.getEmailAddress(), userInfo.getName(), userInfo.getStringListClaim("groups").contains(adminGroup));
-
- request.getSession().setAttribute(SessionResource.USER_ID_KEY, user.getId());
- LogAction.login(user.getId(), ServletHelper.retrieveRemoteAddress(request));
-
- return baseUrl;
- }
-}
+/*
+ * Copyright 2023 Daniel Raper (me@danr.uk)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.database;
+
+import org.traccar.config.Config;
+import org.traccar.config.Keys;
+import org.traccar.api.resource.SessionResource;
+import org.traccar.api.security.LoginService;
+import org.traccar.model.User;
+import org.traccar.storage.StorageException;
+import org.traccar.helper.LogAction;
+import org.traccar.helper.ServletHelper;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.security.GeneralSecurityException;
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import com.google.inject.Inject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.nimbusds.oauth2.sdk.http.HTTPResponse;
+import com.nimbusds.oauth2.sdk.AuthorizationCode;
+import com.nimbusds.oauth2.sdk.ResponseType;
+import com.nimbusds.oauth2.sdk.Scope;
+import com.nimbusds.oauth2.sdk.AuthorizationGrant;
+import com.nimbusds.oauth2.sdk.TokenRequest;
+import com.nimbusds.oauth2.sdk.TokenResponse;
+import com.nimbusds.oauth2.sdk.AuthorizationCodeGrant;
+import com.nimbusds.oauth2.sdk.ParseException;
+import com.nimbusds.oauth2.sdk.AuthorizationResponse;
+import com.nimbusds.oauth2.sdk.auth.Secret;
+import com.nimbusds.oauth2.sdk.auth.ClientSecretBasic;
+import com.nimbusds.oauth2.sdk.auth.ClientAuthentication;
+import com.nimbusds.oauth2.sdk.token.BearerAccessToken;
+import com.nimbusds.oauth2.sdk.id.State;
+import com.nimbusds.oauth2.sdk.id.ClientID;
+import com.nimbusds.openid.connect.sdk.OIDCTokenResponse;
+import com.nimbusds.openid.connect.sdk.Nonce;
+import com.nimbusds.openid.connect.sdk.OIDCTokenResponseParser;
+import com.nimbusds.openid.connect.sdk.UserInfoResponse;
+import com.nimbusds.openid.connect.sdk.UserInfoRequest;
+import com.nimbusds.openid.connect.sdk.AuthenticationRequest;
+
+import com.nimbusds.openid.connect.sdk.claims.UserInfo;
+
+public class OpenIdProvider {
+ private static final Logger LOGGER = LoggerFactory.getLogger(OpenIdProvider.class);
+
+ public final Boolean force;
+ private final ClientID clientId;
+ private final ClientAuthentication clientAuth;
+ private URI callbackUrl;
+ private URI authUrl;
+ private URI tokenUrl;
+ private URI userInfoUrl;
+ private URI baseUrl;
+ private final String adminGroup;
+
+ private LoginService loginService;
+
+ @Inject
+ public OpenIdProvider(Config config, LoginService loginService) {
+ this.loginService = loginService;
+
+ force = config.getBoolean(Keys.OPENID_FORCE);
+ clientId = new ClientID(config.getString(Keys.OPENID_CLIENTID));
+ clientAuth = new ClientSecretBasic(clientId, new Secret(config.getString(Keys.OPENID_CLIENTSECRET)));
+
+ try {
+ callbackUrl = new URI(config.getString(Keys.WEB_URL, "") + "/api/session/openid/callback");
+ authUrl = new URI(config.getString(Keys.OPENID_AUTHURL, ""));
+ tokenUrl = new URI(config.getString(Keys.OPENID_TOKENURL, ""));
+ userInfoUrl = new URI(config.getString(Keys.OPENID_USERINFOURL, ""));
+ baseUrl = new URI(config.getString(Keys.WEB_URL, ""));
+ } catch(URISyntaxException error) {
+ LOGGER.error("Invalid URIs provided in OpenID configuration");
+ }
+
+ adminGroup = config.getString(Keys.OPENID_ADMINGROUP);
+ }
+
+ public URI createAuthUri() {
+ AuthenticationRequest.Builder request = new AuthenticationRequest.Builder(
+ new ResponseType("code"),
+ new Scope("openid", "profile", "email", "groups"),
+ clientId,
+ callbackUrl);
+
+ return request.endpointURI(authUrl)
+ .state(new State())
+ .build()
+ .toURI();
+ }
+
+ private OIDCTokenResponse getToken(AuthorizationCode code) throws IOException, ParseException, GeneralSecurityException {
+ AuthorizationGrant codeGrant = new AuthorizationCodeGrant(code, callbackUrl);
+ TokenRequest tokenRequest = new TokenRequest(tokenUrl, clientAuth, codeGrant);
+
+ HTTPResponse tokenResponse = tokenRequest.toHTTPRequest().send();
+ TokenResponse token = OIDCTokenResponseParser.parse(tokenResponse);
+ if (!token.indicatesSuccess()) {
+ throw new GeneralSecurityException("Unable to authenticate with the OpenID Connect provider.");
+ }
+
+ return (OIDCTokenResponse) token.toSuccessResponse();
+ }
+
+ private UserInfo getUserInfo(BearerAccessToken token) throws IOException, ParseException, GeneralSecurityException {
+ HTTPResponse httpResponse = new UserInfoRequest(userInfoUrl, token)
+ .toHTTPRequest()
+ .send();
+
+ UserInfoResponse userInfoResponse = UserInfoResponse.parse(httpResponse);
+
+ if (!userInfoResponse.indicatesSuccess()) {
+ throw new GeneralSecurityException("Failed to access OpenID Connect user info endpoint. Please contact your administrator.");
+ }
+
+ return userInfoResponse.toSuccessResponse().getUserInfo();
+ }
+
+ public URI handleCallback(URI requestUri, HttpServletRequest request) throws StorageException, ParseException, IOException, GeneralSecurityException {
+ AuthorizationResponse response = AuthorizationResponse.parse(requestUri);
+
+ if (!response.indicatesSuccess()) {
+ throw new GeneralSecurityException(response.toErrorResponse().getErrorObject().getDescription());
+ }
+
+ AuthorizationCode authCode = response.toSuccessResponse().getAuthorizationCode();
+
+ if (authCode == null) {
+ throw new GeneralSecurityException( "Malformed OpenID callback.");
+ }
+
+ OIDCTokenResponse tokens = getToken(authCode);
+
+ BearerAccessToken bearerToken = tokens.getOIDCTokens().getBearerAccessToken();
+
+ UserInfo userInfo = getUserInfo(bearerToken);
+
+ User user = loginService.login(userInfo.getEmailAddress(), userInfo.getName(), userInfo.getStringListClaim("groups").contains(adminGroup));
+
+ request.getSession().setAttribute(SessionResource.USER_ID_KEY, user.getId());
+ LogAction.login(user.getId(), ServletHelper.retrieveRemoteAddress(request));
+
+ return baseUrl;
+ }
+}
diff --git a/swagger.json b/swagger.json
index d3a83ba76..5a7349da8 100644
--- a/swagger.json
+++ b/swagger.json
@@ -1,3542 +1,3526 @@
-{
- "openapi": "3.0.1",
- "info": {
- "title": "Traccar",
- "version": "5.6",
- "description": "Traccar GPS tracking server API documentation. To use the API you need to have a server instance. For testing purposes you can use one of free [demo servers](https://www.traccar.org/demo-server/). For production use you can install your own server or get a [subscription service](https://www.traccar.org/product/tracking-server/).",
- "contact": {
- "name": "Traccar Support",
- "url": "https://www.traccar.org/",
- "email": "support@traccar.org"
- },
- "license": {
- "name": "Apache 2.0",
- "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
- }
- },
- "servers": [
- {
- "url": "https://demo.traccar.org/api",
- "description": "Demo Server 1"
- },
- {
- "url": "https://demo2.traccar.org/api",
- "description": "Demo Server 2"
- },
- {
- "url": "https://demo3.traccar.org/api",
- "description": "Demo Server 3"
- },
- {
- "url": "https://demo4.traccar.org/api",
- "description": "Demo Server 4"
- },
- {
- "url": "https://server.traccar.org/api",
- "description": "Subscription Server"
- },
- {
- "url": "http://{host}:{port}/api",
- "description": "Other Server",
- "variables": {
- "host": {
- "default": "localhost"
- },
- "port": {
- "enum": [
- "8082",
- "80"
- ],
- "default": "8082"
- }
- }
- }
- ],
- "security": [
- {
- "basicAuth": []
- }
- ],
- "tags": [
- {
- "name": "Server",
- "description": "Server information"
- },
- {
- "name": "Session",
- "description": "User session management"
- },
- {
- "name": "Devices",
- "description": "Device management"
- },
- {
- "name": "Groups",
- "description": "Group management"
- },
- {
- "name": "Users",
- "description": "User management"
- },
- {
- "name": "Permissions",
- "description": "User permissions and other object linking"
- },
- {
- "name": "Positions",
- "description": "Retrieving raw location information"
- },
- {
- "name": "Events",
- "description": "Retrieving event information"
- },
- {
- "name": "Reports",
- "description": "Reports generation"
- },
- {
- "name": "Notifications",
- "description": "User notifications management"
- },
- {
- "name": "Geofences",
- "description": "Geofence management"
- },
- {
- "name": "Commands",
- "description": "Sending commands to devices and stored command management"
- },
- {
- "name": "Attributes",
- "description": "Computed attributes management"
- },
- {
- "name": "Drivers",
- "description": "Drivers management"
- },
- {
- "name": "Maintenance",
- "description": "Maintenance management"
- },
- {
- "name": "Calendars",
- "description": "Calendar management"
- },
- {
- "name": "Statistics",
- "description": "Retrieving server statistics"
- }
- ],
- "paths": {
- "/commands": {
- "get": {
- "summary": "Fetch a list of Saved Commands",
- "tags": [
- "Commands"
- ],
- "description": "Without params, it returns a list of Saved Commands the user has access to",
- "parameters": [
- {
- "name": "all",
- "in": "query",
- "description": "Can only be used by admins or managers to fetch all entities",
- "schema": {
- "type": "boolean"
- }
- },
- {
- "name": "userId",
- "in": "query",
- "description": "Standard users can use this only with their own _userId_",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "deviceId",
- "in": "query",
- "description": "Standard users can use this only with _deviceId_s, they have access to",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "groupId",
- "in": "query",
- "description": "Standard users can use this only with _groupId_s, they have access to",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "refresh",
- "in": "query",
- "schema": {
- "type": "boolean"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Command"
- }
- }
- }
- }
- }
- }
- },
- "post": {
- "summary": "Create a Saved Command",
- "tags": [
- "Commands"
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Command"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Command"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- }
- },
- "/commands/{id}": {
- "put": {
- "summary": "Update a Saved Command",
- "tags": [
- "Commands"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Command"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Command"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- },
- "delete": {
- "summary": "Delete a Saved Command",
- "tags": [
- "Commands"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "No Content",
- "content": {}
- }
- }
- }
- },
- "/commands/send": {
- "get": {
- "summary": "Fetch a list of Saved Commands supported by Device at the moment",
- "description": "Return a list of saved commands linked to Device and its groups, filtered by current Device protocol support",
- "tags": [
- "Commands"
- ],
- "parameters": [
- {
- "name": "deviceId",
- "in": "query",
- "description": "Standard users can use this only with _deviceId_s, they have access to",
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Command"
- }
- }
- }
- }
- },
- "400": {
- "description": "Could happen when the user doesn't have permission for the device",
- "content": {}
- }
- }
- },
- "post": {
- "summary": "Dispatch commands to device",
- "description": "Dispatch a new command or Saved Command if _body.id_ set",
- "tags": [
- "Commands"
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Command"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "Command sent",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Command"
- }
- }
- }
- },
- "202": {
- "description": "Command queued",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Command"
- }
- }
- }
- },
- "400": {
- "description": "Could happen when the user doesn't have permission or an incorrect command _type_ for the device",
- "content": {}
- }
- },
- "x-codegen-request-body-name": "body"
- }
- },
- "/commands/types": {
- "get": {
- "summary": "Fetch a list of available Commands for the Device or all possible Commands if Device ommited",
- "tags": [
- "Commands"
- ],
- "parameters": [
- {
- "name": "deviceId",
- "in": "query",
- "description": "Internal device identifier. Only works if device has already reported some locations",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "protocol",
- "in": "query",
- "description": "Protocol name. Can be used instead of device id",
- "schema": {
- "type": "string"
- }
- },
- {
- "name": "textChannel",
- "in": "query",
- "description": "When `true` return SMS commands. If not specified or `false` return data commands",
- "schema": {
- "type": "boolean"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/CommandType"
- }
- }
- }
- }
- },
- "400": {
- "description": "Could happen when trying to fetch from a device the user does not have permission",
- "content": {}
- }
- }
- }
- },
- "/devices": {
- "get": {
- "summary": "Fetch a list of Devices",
- "description": "Without any params, returns a list of the user's devices",
- "tags": [
- "Devices"
- ],
- "parameters": [
- {
- "name": "all",
- "in": "query",
- "description": "Can only be used by admins or managers to fetch all entities",
- "schema": {
- "type": "boolean"
- }
- },
- {
- "name": "userId",
- "in": "query",
- "description": "Standard users can use this only with their own _userId_",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "id",
- "in": "query",
- "description": "To fetch one or more devices. Multiple params can be passed like `id=31&id=42`",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "uniqueId",
- "in": "query",
- "description": "To fetch one or more devices. Multiple params can be passed like `uniqueId=333331&uniqieId=44442`",
- "schema": {
- "type": "string"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Device"
- }
- }
- }
- }
- },
- "400": {
- "description": "No permission",
- "content": {}
- }
- }
- },
- "post": {
- "summary": "Create a Device",
- "tags": [
- "Devices"
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Device"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Device"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- }
- },
- "/devices/{id}": {
- "put": {
- "summary": "Update a Device",
- "tags": [
- "Devices"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Device"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Device"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- },
- "delete": {
- "summary": "Delete a Device",
- "tags": [
- "Devices"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "No Content",
- "content": {}
- }
- }
- }
- },
- "/devices/{id}/accumulators": {
- "put": {
- "summary": "Update total distance and hours of the Device",
- "tags": [
- "Devices"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/DeviceAccumulators"
- }
- }
- },
- "required": true
- },
- "responses": {
- "204": {
- "description": "No Content",
- "content": {}
- }
- },
- "x-codegen-request-body-name": "body"
- }
- },
- "/groups": {
- "get": {
- "summary": "Fetch a list of Groups",
- "description": "Without any params, returns a list of the Groups the user belongs to",
- "tags": [
- "Groups"
- ],
- "parameters": [
- {
- "name": "all",
- "in": "query",
- "description": "Can only be used by admins or managers to fetch all entities",
- "schema": {
- "type": "boolean"
- }
- },
- {
- "name": "userId",
- "in": "query",
- "description": "Standard users can use this only with their own _userId_",
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Group"
- }
- }
- }
- }
- }
- }
- },
- "post": {
- "summary": "Create a Group",
- "tags": [
- "Groups"
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Group"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Group"
- }
- }
- }
- },
- "400": {
- "description": "No permission",
- "content": {}
- }
- },
- "x-codegen-request-body-name": "body"
- }
- },
- "/groups/{id}": {
- "put": {
- "summary": "Update a Group",
- "tags": [
- "Groups"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Group"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Group"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- },
- "delete": {
- "summary": "Delete a Group",
- "tags": [
- "Groups"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "No Content",
- "content": {}
- }
- }
- }
- },
- "/permissions": {
- "post": {
- "summary": "Link an Object to another Object",
- "tags": [
- "Permissions"
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Permission"
- }
- }
- },
- "required": true
- },
- "responses": {
- "204": {
- "description": "No Content",
- "content": {}
- },
- "400": {
- "description": "No permission",
- "content": {}
- }
- },
- "x-codegen-request-body-name": "body"
- },
- "delete": {
- "summary": "Unlink an Object from another Object",
- "tags": [
- "Permissions"
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Permission"
- }
- }
- },
- "required": true
- },
- "responses": {
- "204": {
- "description": "No Content",
- "content": {}
- }
- },
- "x-codegen-request-body-name": "body"
- }
- },
- "/positions": {
- "get": {
- "summary": "Fetches a list of Positions",
- "description": "We strongly recommend using [Traccar WebSocket API](https://www.traccar.org/traccar-api/) instead of periodically polling positions endpoint. Without any params, it returns a list of last known positions for all the user's Devices. _from_ and _to_ fields are not required with _id_.",
- "tags": [
- "Positions"
- ],
- "parameters": [
- {
- "name": "deviceId",
- "in": "query",
- "description": "_deviceId_ is optional, but requires the _from_ and _to_ parameters when used",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "from",
- "in": "query",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- },
- {
- "name": "to",
- "in": "query",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- },
- {
- "name": "id",
- "in": "query",
- "description": "To fetch one or more positions. Multiple params can be passed like `id=31&id=42`",
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Position"
- }
- }
- },
- "text/csv": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Position"
- }
- }
- },
- "application/gpx+xml": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Position"
- }
- }
- }
- }
- }
- }
- }
- },
- "/server": {
- "get": {
- "summary": "Fetch Server information",
- "tags": [
- "Server"
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Server"
- }
- }
- }
- }
- }
- },
- "put": {
- "summary": "Update Server information",
- "tags": [
- "Server"
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Server"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Server"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- }
- },
- "/session": {
- "get": {
- "summary": "Fetch Session information",
- "tags": [
- "Session"
- ],
- "parameters": [
- {
- "name": "token",
- "in": "query",
- "schema": {
- "type": "string"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/User"
- }
- }
- }
- },
- "404": {
- "description": "Not Found",
- "content": {}
- }
- }
- },
- "post": {
- "summary": "Create a new Session",
- "tags": [
- "Session"
- ],
- "requestBody": {
- "content": {
- "application/x-www-form-urlencoded": {
- "schema": {
- "required": [
- "email",
- "password"
- ],
- "properties": {
- "email": {
- "type": "string"
- },
- "password": {
- "type": "string",
- "format": "password"
- }
- }
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/User"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized",
- "content": {}
- }
- }
- },
- "delete": {
- "summary": "Close the Session",
- "tags": [
- "Session"
- ],
- "responses": {
- "204": {
- "description": "No Content",
- "content": {}
- }
- }
- }
- },
- "/session/openid/auth": {
- "get": {
- "summary": "Fetch Session information",
- "tags": [
- "Session"
- ],
- "parameters": [
- {
- }
- ],
- "responses": {
- "303": {
- "description": "Redirect to OpenID Connect identity provider",
- "content": { }
- },
- "404": {
- "description": "OpenID Connect disabled",
- "content": { }
- }
- }
- }
- },
- "/session/openid/callback": {
- "get": {
- "summary": "OpenID Callback",
- "tags": [
- "Session"
- ],
- "parameters": [
- {
- }
- ],
- "responses": {
- "303": {
- "description": "Successful authentication, redirect to homepage",
- "content": { }
- },
- "403": {
- "description": "Invalid callback or negative response from identity provider",
- "content": { }
- },
- "404": {
- "description": "OpenID Connect disabled",
- "content": { }
- },
- "500": {
- "description": "Other OpenID Connect error",
- "content": { }
- }
- }
- }
- },
- "/users": {
- "get": {
- "summary": "Fetch a list of Users",
- "tags": [
- "Users"
- ],
- "parameters": [
- {
- "name": "userId",
- "in": "query",
- "description": "Can only be used by admin or manager users",
- "schema": {
- "type": "string"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/User"
- }
- }
- }
- }
- },
- "400": {
- "description": "No Permission",
- "content": {}
- }
- }
- },
- "post": {
- "summary": "Create a User",
- "tags": [
- "Users"
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/User"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/User"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- }
- },
- "/users/{id}": {
- "put": {
- "summary": "Update a User",
- "tags": [
- "Users"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/User"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/User"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- },
- "delete": {
- "summary": "Delete a User",
- "tags": [
- "Users"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "No Content",
- "content": {}
- }
- }
- }
- },
- "/notifications": {
- "get": {
- "summary": "Fetch a list of Notifications",
- "description": "Without params, it returns a list of Notifications the user has access to",
- "tags": [
- "Notifications"
- ],
- "parameters": [
- {
- "name": "all",
- "in": "query",
- "description": "Can only be used by admins or managers to fetch all entities",
- "schema": {
- "type": "boolean"
- }
- },
- {
- "name": "userId",
- "in": "query",
- "description": "Standard users can use this only with their own _userId_",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "deviceId",
- "in": "query",
- "description": "Standard users can use this only with _deviceId_s, they have access to",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "groupId",
- "in": "query",
- "description": "Standard users can use this only with _groupId_s, they have access to",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "refresh",
- "in": "query",
- "schema": {
- "type": "boolean"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Notification"
- }
- }
- }
- }
- }
- }
- },
- "post": {
- "summary": "Create a Notification",
- "tags": [
- "Notifications"
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Notification"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Notification"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- }
- },
- "/notifications/{id}": {
- "put": {
- "summary": "Update a Notification",
- "tags": [
- "Notifications"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Notification"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Notification"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- },
- "delete": {
- "summary": "Delete a Notification",
- "tags": [
- "Notifications"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "No Content",
- "content": {}
- }
- }
- }
- },
- "/notifications/types": {
- "get": {
- "summary": "Fetch a list of available Notification types",
- "tags": [
- "Notifications"
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/NotificationType"
- }
- }
- }
- }
- }
- }
- }
- },
- "/notifications/test": {
- "post": {
- "summary": "Send test notification to current user via Email and SMS",
- "tags": [
- "Notifications"
- ],
- "responses": {
- "204": {
- "description": "Successful sending",
- "content": {}
- },
- "400": {
- "description": "Could happen if sending has failed",
- "content": {}
- }
- }
- }
- },
- "/geofences": {
- "get": {
- "summary": "Fetch a list of Geofences",
- "description": "Without params, it returns a list of Geofences the user has access to",
- "tags": [
- "Geofences"
- ],
- "parameters": [
- {
- "name": "all",
- "in": "query",
- "description": "Can only be used by admins or managers to fetch all entities",
- "schema": {
- "type": "boolean"
- }
- },
- {
- "name": "userId",
- "in": "query",
- "description": "Standard users can use this only with their own _userId_",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "deviceId",
- "in": "query",
- "description": "Standard users can use this only with _deviceId_s, they have access to",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "groupId",
- "in": "query",
- "description": "Standard users can use this only with _groupId_s, they have access to",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "refresh",
- "in": "query",
- "schema": {
- "type": "boolean"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Geofence"
- }
- }
- }
- }
- }
- }
- },
- "post": {
- "summary": "Create a Geofence",
- "tags": [
- "Geofences"
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Geofence"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Geofence"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- }
- },
- "/geofences/{id}": {
- "put": {
- "summary": "Update a Geofence",
- "tags": [
- "Geofences"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Geofence"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Geofence"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- },
- "delete": {
- "summary": "Delete a Geofence",
- "tags": [
- "Geofences"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "No Content",
- "content": {}
- }
- }
- }
- },
- "/events/{id}": {
- "get": {
- "tags": [
- "Events"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Event"
- }
- }
- }
- }
- }
- }
- },
- "/reports/route": {
- "get": {
- "summary": "Fetch a list of Positions within the time period for the Devices or Groups",
- "description": "At least one _deviceId_ or one _groupId_ must be passed",
- "tags": [
- "Reports"
- ],
- "parameters": [
- {
- "name": "deviceId",
- "in": "query",
- "style": "form",
- "explode": true,
- "schema": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- }
- },
- {
- "name": "groupId",
- "in": "query",
- "style": "form",
- "explode": true,
- "schema": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- }
- },
- {
- "name": "from",
- "in": "query",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- },
- {
- "name": "to",
- "in": "query",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Position"
- }
- }
- },
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Position"
- }
- }
- }
- }
- }
- }
- }
- },
- "/reports/events": {
- "get": {
- "summary": "Fetch a list of Events within the time period for the Devices or Groups",
- "description": "At least one _deviceId_ or one _groupId_ must be passed",
- "tags": [
- "Reports"
- ],
- "parameters": [
- {
- "name": "deviceId",
- "in": "query",
- "style": "form",
- "explode": true,
- "schema": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- }
- },
- {
- "name": "groupId",
- "in": "query",
- "style": "form",
- "explode": true,
- "schema": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- }
- },
- {
- "name": "type",
- "in": "query",
- "description": "% can be used to return events of all types",
- "style": "form",
- "explode": false,
- "schema": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- },
- {
- "name": "from",
- "in": "query",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- },
- {
- "name": "to",
- "in": "query",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Event"
- }
- }
- },
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Event"
- }
- }
- }
- }
- }
- }
- }
- },
- "/reports/summary": {
- "get": {
- "summary": "Fetch a list of ReportSummary within the time period for the Devices or Groups",
- "description": "At least one _deviceId_ or one _groupId_ must be passed",
- "tags": [
- "Reports"
- ],
- "parameters": [
- {
- "name": "deviceId",
- "in": "query",
- "style": "form",
- "explode": true,
- "schema": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- }
- },
- {
- "name": "groupId",
- "in": "query",
- "style": "form",
- "explode": true,
- "schema": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- }
- },
- {
- "name": "from",
- "in": "query",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- },
- {
- "name": "to",
- "in": "query",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/ReportSummary"
- }
- }
- },
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/ReportSummary"
- }
- }
- }
- }
- }
- }
- }
- },
- "/reports/trips": {
- "get": {
- "summary": "Fetch a list of ReportTrips within the time period for the Devices or Groups",
- "description": "At least one _deviceId_ or one _groupId_ must be passed",
- "tags": [
- "Reports"
- ],
- "parameters": [
- {
- "name": "deviceId",
- "in": "query",
- "style": "form",
- "explode": true,
- "schema": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- }
- },
- {
- "name": "groupId",
- "in": "query",
- "style": "form",
- "explode": true,
- "schema": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- }
- },
- {
- "name": "from",
- "in": "query",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- },
- {
- "name": "to",
- "in": "query",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/ReportTrips"
- }
- }
- },
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/ReportTrips"
- }
- }
- }
- }
- }
- }
- }
- },
- "/reports/stops": {
- "get": {
- "summary": "Fetch a list of ReportStops within the time period for the Devices or Groups",
- "description": "At least one _deviceId_ or one _groupId_ must be passed",
- "tags": [
- "Reports"
- ],
- "parameters": [
- {
- "name": "deviceId",
- "in": "query",
- "style": "form",
- "explode": true,
- "schema": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- }
- },
- {
- "name": "groupId",
- "in": "query",
- "style": "form",
- "explode": true,
- "schema": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- }
- },
- {
- "name": "from",
- "in": "query",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- },
- {
- "name": "to",
- "in": "query",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/ReportStops"
- }
- }
- },
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/ReportStops"
- }
- }
- }
- }
- }
- }
- }
- },
- "/statistics": {
- "get": {
- "summary": "Fetch server Statistics",
- "tags": [
- "Statistics"
- ],
- "parameters": [
- {
- "name": "from",
- "in": "query",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- },
- {
- "name": "to",
- "in": "query",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Statistics"
- }
- }
- }
- }
- }
- }
- }
- },
- "/calendars": {
- "get": {
- "summary": "Fetch a list of Calendars",
- "description": "Without params, it returns a list of Calendars the user has access to",
- "tags": [
- "Calendars"
- ],
- "parameters": [
- {
- "name": "all",
- "in": "query",
- "description": "Can only be used by admins or managers to fetch all entities",
- "schema": {
- "type": "boolean"
- }
- },
- {
- "name": "userId",
- "in": "query",
- "description": "Standard users can use this only with their own _userId_",
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Calendar"
- }
- }
- }
- }
- }
- }
- },
- "post": {
- "summary": "Create a Calendar",
- "tags": [
- "Calendars"
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Calendar"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Calendar"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- }
- },
- "/calendars/{id}": {
- "put": {
- "summary": "Update a Calendar",
- "tags": [
- "Calendars"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Calendar"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Calendar"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- },
- "delete": {
- "summary": "Delete a Calendar",
- "tags": [
- "Calendars"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "No Content",
- "content": {}
- }
- }
- }
- },
- "/attributes/computed": {
- "get": {
- "summary": "Fetch a list of Attributes",
- "description": "Without params, it returns a list of Attributes the user has access to",
- "tags": [
- "Attributes"
- ],
- "parameters": [
- {
- "name": "all",
- "in": "query",
- "description": "Can only be used by admins or managers to fetch all entities",
- "schema": {
- "type": "boolean"
- }
- },
- {
- "name": "userId",
- "in": "query",
- "description": "Standard users can use this only with their own _userId_",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "deviceId",
- "in": "query",
- "description": "Standard users can use this only with _deviceId_s, they have access to",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "groupId",
- "in": "query",
- "description": "Standard users can use this only with _groupId_s, they have access to",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "refresh",
- "in": "query",
- "schema": {
- "type": "boolean"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Attribute"
- }
- }
- }
- }
- }
- }
- },
- "post": {
- "summary": "Create an Attribute",
- "tags": [
- "Attributes"
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Attribute"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Attribute"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- }
- },
- "/attributes/computed/{id}": {
- "put": {
- "summary": "Update an Attribute",
- "tags": [
- "Attributes"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Attribute"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Attribute"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- },
- "delete": {
- "summary": "Delete an Attribute",
- "tags": [
- "Attributes"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "No Content",
- "content": {}
- }
- }
- }
- },
- "/drivers": {
- "get": {
- "summary": "Fetch a list of Drivers",
- "description": "Without params, it returns a list of Drivers the user has access to",
- "tags": [
- "Drivers"
- ],
- "parameters": [
- {
- "name": "all",
- "in": "query",
- "description": "Can only be used by admins or managers to fetch all entities",
- "schema": {
- "type": "boolean"
- }
- },
- {
- "name": "userId",
- "in": "query",
- "description": "Standard users can use this only with their own _userId_",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "deviceId",
- "in": "query",
- "description": "Standard users can use this only with _deviceId_s, they have access to",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "groupId",
- "in": "query",
- "description": "Standard users can use this only with _groupId_s, they have access to",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "refresh",
- "in": "query",
- "schema": {
- "type": "boolean"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Driver"
- }
- }
- }
- }
- }
- }
- },
- "post": {
- "summary": "Create a Driver",
- "tags": [
- "Drivers"
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Driver"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Driver"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- }
- },
- "/drivers/{id}": {
- "put": {
- "summary": "Update a Driver",
- "tags": [
- "Drivers"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Driver"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Driver"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- },
- "delete": {
- "summary": "Delete a Driver",
- "tags": [
- "Drivers"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "No Content",
- "content": {}
- }
- }
- }
- },
- "/maintenance": {
- "get": {
- "summary": "Fetch a list of Maintenance",
- "description": "Without params, it returns a list of Maintenance the user has access to",
- "tags": [
- "Maintenance"
- ],
- "parameters": [
- {
- "name": "all",
- "in": "query",
- "description": "Can only be used by admins or managers to fetch all entities",
- "schema": {
- "type": "boolean"
- }
- },
- {
- "name": "userId",
- "in": "query",
- "description": "Standard users can use this only with their own _userId_",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "deviceId",
- "in": "query",
- "description": "Standard users can use this only with _deviceId_s, they have access to",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "groupId",
- "in": "query",
- "description": "Standard users can use this only with _groupId_s, they have access to",
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "refresh",
- "in": "query",
- "schema": {
- "type": "boolean"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Maintenance"
- }
- }
- }
- }
- }
- }
- },
- "post": {
- "summary": "Create a Maintenance",
- "tags": [
- "Maintenance"
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Maintenance"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Maintenance"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- }
- },
- "/maintenance/{id}": {
- "put": {
- "summary": "Update a Maintenance",
- "tags": [
- "Maintenance"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Maintenance"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Maintenance"
- }
- }
- }
- }
- },
- "x-codegen-request-body-name": "body"
- },
- "delete": {
- "summary": "Delete a Maintenance",
- "tags": [
- "Maintenance"
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "No Content",
- "content": {}
- }
- }
- }
- }
- },
- "components": {
- "schemas": {
- "Position": {
- "type": "object",
- "properties": {
- "id": {
- "type": "integer"
- },
- "deviceId": {
- "type": "integer"
- },
- "protocol": {
- "type": "string"
- },
- "deviceTime": {
- "type": "string",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "format": "date-time"
- },
- "fixTime": {
- "type": "string",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "format": "date-time"
- },
- "serverTime": {
- "type": "string",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "format": "date-time"
- },
- "outdated": {
- "type": "boolean"
- },
- "valid": {
- "type": "boolean"
- },
- "latitude": {
- "type": "number"
- },
- "longitude": {
- "type": "number"
- },
- "altitude": {
- "type": "number"
- },
- "speed": {
- "type": "number",
- "description": "in knots"
- },
- "course": {
- "type": "number"
- },
- "address": {
- "type": "string"
- },
- "accuracy": {
- "type": "number"
- },
- "network": {
- "type": "object",
- "properties": {}
- },
- "attributes": {
- "type": "object",
- "properties": {}
- }
- }
- },
- "User": {
- "type": "object",
- "properties": {
- "id": {
- "type": "integer"
- },
- "name": {
- "type": "string"
- },
- "email": {
- "type": "string"
- },
- "phone": {
- "type": "string"
- },
- "readonly": {
- "type": "boolean"
- },
- "administrator": {
- "type": "boolean"
- },
- "map": {
- "type": "string"
- },
- "latitude": {
- "type": "number"
- },
- "longitude": {
- "type": "number"
- },
- "zoom": {
- "type": "integer"
- },
- "password": {
- "type": "string"
- },
- "twelveHourFormat": {
- "type": "boolean"
- },
- "coordinateFormat": {
- "type": "string"
- },
- "disabled": {
- "type": "boolean"
- },
- "expirationTime": {
- "type": "string",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "format": "date-time"
- },
- "deviceLimit": {
- "type": "integer"
- },
- "userLimit": {
- "type": "integer"
- },
- "deviceReadonly": {
- "type": "boolean"
- },
- "limitCommands": {
- "type": "boolean"
- },
- "poiLayer": {
- "type": "string"
- },
- "attributes": {
- "type": "object",
- "properties": {}
- }
- }
- },
- "Server": {
- "type": "object",
- "properties": {
- "id": {
- "type": "integer"
- },
- "registration": {
- "type": "boolean"
- },
- "readonly": {
- "type": "boolean"
- },
- "deviceReadonly": {
- "type": "boolean"
- },
- "limitCommands": {
- "type": "boolean"
- },
- "map": {
- "type": "string"
- },
- "bingKey": {
- "type": "string"
- },
- "mapUrl": {
- "type": "string"
- },
- "poiLayer": {
- "type": "string"
- },
- "latitude": {
- "type": "number"
- },
- "longitude": {
- "type": "number"
- },
- "zoom": {
- "type": "integer"
- },
- "twelveHourFormat": {
- "type": "boolean"
- },
- "version": {
- "type": "string"
- },
- "forceSettings": {
- "type": "boolean"
- },
- "coordinateFormat": {
- "type": "string"
- },
- "oidcEnabled": {
- "type": "boolean"
- },
- "oidcForce": {
- "type": "boolean"
- },
- "attributes": {
- "type": "object",
- "properties": {}
- }
- }
- },
- "Command": {
- "type": "object",
- "properties": {
- "id": {
- "type": "integer"
- },
- "deviceId": {
- "type": "integer"
- },
- "description": {
- "type": "string"
- },
- "type": {
- "type": "string"
- },
- "attributes": {
- "type": "object",
- "properties": {}
- }
- }
- },
- "Device": {
- "type": "object",
- "properties": {
- "id": {
- "type": "integer"
- },
- "name": {
- "type": "string"
- },
- "uniqueId": {
- "type": "string"
- },
- "status": {
- "type": "string"
- },
- "disabled": {
- "type": "boolean"
- },
- "lastUpdate": {
- "type": "string",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "format": "date-time"
- },
- "positionId": {
- "type": "integer"
- },
- "groupId": {
- "type": "integer"
- },
- "phone": {
- "type": "string"
- },
- "model": {
- "type": "string"
- },
- "contact": {
- "type": "string"
- },
- "category": {
- "type": "string"
- },
- "geofenceIds": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- },
- "attributes": {
- "type": "object",
- "properties": {}
- }
- }
- },
- "Group": {
- "type": "object",
- "properties": {
- "id": {
- "type": "integer"
- },
- "name": {
- "type": "string"
- },
- "groupId": {
- "type": "integer"
- },
- "attributes": {
- "type": "object",
- "properties": {}
- }
- }
- },
- "Permission": {
- "type": "object",
- "properties": {
- "userId": {
- "type": "integer",
- "description": "User Id, can be only first parameter"
- },
- "deviceId": {
- "type": "integer",
- "description": "Device Id, can be first parameter or second only in combination with userId"
- },
- "groupId": {
- "type": "integer",
- "description": "Group Id, can be first parameter or second only in combination with userId"
- },
- "geofenceId": {
- "type": "integer",
- "description": "Geofence Id, can be second parameter only"
- },
- "notificationId": {
- "type": "integer",
- "description": "Notification Id, can be second parameter only"
- },
- "calendarId": {
- "type": "integer",
- "description": "Calendar Id, can be second parameter only and only in combination with userId"
- },
- "attributeId": {
- "type": "integer",
- "description": "Computed Attribute Id, can be second parameter only"
- },
- "driverId": {
- "type": "integer",
- "description": "Driver Id, can be second parameter only"
- },
- "managedUserId": {
- "type": "integer",
- "description": "User Id, can be second parameter only and only in combination with userId"
- }
- },
- "description": "This is a permission map that contain two object indexes. It is used to link/unlink objects. Order is important. Example: { deviceId:8, geofenceId: 16 }"
- },
- "CommandType": {
- "type": "object",
- "properties": {
- "type": {
- "type": "string"
- }
- }
- },
- "Geofence": {
- "type": "object",
- "properties": {
- "id": {
- "type": "integer"
- },
- "name": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "area": {
- "type": "string"
- },
- "calendarId": {
- "type": "integer"
- },
- "attributes": {
- "type": "object",
- "properties": {}
- }
- }
- },
- "Notification": {
- "type": "object",
- "properties": {
- "id": {
- "type": "integer"
- },
- "type": {
- "type": "string"
- },
- "always": {
- "type": "boolean"
- },
- "web": {
- "type": "boolean"
- },
- "mail": {
- "type": "boolean"
- },
- "sms": {
- "type": "boolean"
- },
- "calendarId": {
- "type": "integer"
- },
- "attributes": {
- "type": "object",
- "properties": {}
- }
- }
- },
- "NotificationType": {
- "type": "object",
- "properties": {
- "type": {
- "type": "string"
- }
- }
- },
- "Event": {
- "type": "object",
- "properties": {
- "id": {
- "type": "integer"
- },
- "type": {
- "type": "string"
- },
- "eventTime": {
- "type": "string",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "format": "date-time"
- },
- "deviceId": {
- "type": "integer"
- },
- "positionId": {
- "type": "integer"
- },
- "geofenceId": {
- "type": "integer"
- },
- "maintenanceId": {
- "type": "integer"
- },
- "attributes": {
- "type": "object",
- "properties": {}
- }
- }
- },
- "ReportSummary": {
- "type": "object",
- "properties": {
- "deviceId": {
- "type": "integer"
- },
- "deviceName": {
- "type": "string"
- },
- "maxSpeed": {
- "type": "number",
- "description": "in knots"
- },
- "averageSpeed": {
- "type": "number",
- "description": "in knots"
- },
- "distance": {
- "type": "number",
- "description": "in meters"
- },
- "spentFuel": {
- "type": "number",
- "description": "in liters"
- },
- "engineHours": {
- "type": "integer"
- }
- }
- },
- "ReportTrips": {
- "type": "object",
- "properties": {
- "deviceId": {
- "type": "integer"
- },
- "deviceName": {
- "type": "string"
- },
- "maxSpeed": {
- "type": "number",
- "description": "in knots"
- },
- "averageSpeed": {
- "type": "number",
- "description": "in knots"
- },
- "distance": {
- "type": "number",
- "description": "in meters"
- },
- "spentFuel": {
- "type": "number",
- "description": "in liters"
- },
- "duration": {
- "type": "integer"
- },
- "startTime": {
- "type": "string",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "format": "date-time"
- },
- "startAddress": {
- "type": "string"
- },
- "startLat": {
- "type": "number"
- },
- "startLon": {
- "type": "number"
- },
- "endTime": {
- "type": "string",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "format": "date-time"
- },
- "endAddress": {
- "type": "string"
- },
- "endLat": {
- "type": "number"
- },
- "endLon": {
- "type": "number"
- },
- "driverUniqueId": {
- "type": "integer"
- },
- "driverName": {
- "type": "string"
- }
- }
- },
- "ReportStops": {
- "type": "object",
- "properties": {
- "deviceId": {
- "type": "integer"
- },
- "deviceName": {
- "type": "string"
- },
- "duration": {
- "type": "integer"
- },
- "startTime": {
- "type": "string",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "format": "date-time"
- },
- "address": {
- "type": "string"
- },
- "lat": {
- "type": "number"
- },
- "lon": {
- "type": "number"
- },
- "endTime": {
- "type": "string",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "format": "date-time"
- },
- "spentFuel": {
- "type": "number",
- "description": "in liters"
- },
- "engineHours": {
- "type": "integer"
- }
- }
- },
- "Statistics": {
- "type": "object",
- "properties": {
- "captureTime": {
- "type": "string",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "format": "date-time"
- },
- "activeUsers": {
- "type": "integer"
- },
- "activeDevices": {
- "type": "integer"
- },
- "requests": {
- "type": "integer"
- },
- "messagesReceived": {
- "type": "integer"
- },
- "messagesStored": {
- "type": "integer"
- }
- }
- },
- "DeviceAccumulators": {
- "type": "object",
- "properties": {
- "deviceId": {
- "type": "integer"
- },
- "totalDistance": {
- "type": "number",
- "description": "in meters"
- },
- "hours": {
- "type": "number"
- }
- }
- },
- "Calendar": {
- "type": "object",
- "properties": {
- "id": {
- "type": "integer"
- },
- "name": {
- "type": "string"
- },
- "data": {
- "type": "string",
- "description": "base64 encoded in iCalendar format"
- },
- "attributes": {
- "type": "object",
- "properties": {}
- }
- }
- },
- "Attribute": {
- "type": "object",
- "properties": {
- "id": {
- "type": "integer"
- },
- "description": {
- "type": "string"
- },
- "attribute": {
- "type": "string"
- },
- "expression": {
- "type": "string"
- },
- "type": {
- "type": "string",
- "description": "String|Number|Boolean"
- }
- }
- },
- "Driver": {
- "type": "object",
- "properties": {
- "id": {
- "type": "integer"
- },
- "name": {
- "type": "string"
- },
- "uniqueId": {
- "type": "string"
- },
- "attributes": {
- "type": "object",
- "properties": {}
- }
- }
- },
- "Maintenance": {
- "type": "object",
- "properties": {
- "id": {
- "type": "integer"
- },
- "name": {
- "type": "string"
- },
- "type": {
- "type": "string"
- },
- "start": {
- "type": "number"
- },
- "period": {
- "type": "number"
- },
- "attributes": {
- "type": "object",
- "properties": {}
- }
- }
- }
- },
- "parameters": {
- "entityId": {
- "name": "id",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- },
- "all": {
- "name": "all",
- "in": "query",
- "description": "Can only be used by admins or managers to fetch all entities",
- "schema": {
- "type": "boolean"
- }
- },
- "refresh": {
- "name": "refresh",
- "in": "query",
- "schema": {
- "type": "boolean"
- }
- },
- "userId": {
- "name": "userId",
- "in": "query",
- "description": "Standard users can use this only with their own _userId_",
- "schema": {
- "type": "integer"
- }
- },
- "deviceId": {
- "name": "deviceId",
- "in": "query",
- "description": "Standard users can use this only with _deviceId_s, they have access to",
- "schema": {
- "type": "integer"
- }
- },
- "groupId": {
- "name": "groupId",
- "in": "query",
- "description": "Standard users can use this only with _groupId_s, they have access to",
- "schema": {
- "type": "integer"
- }
- },
- "deviceIdArray": {
- "name": "deviceId",
- "in": "query",
- "style": "form",
- "explode": true,
- "schema": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- }
- },
- "groupIdArray": {
- "name": "groupId",
- "in": "query",
- "style": "form",
- "explode": true,
- "schema": {
- "type": "array",
- "items": {
- "type": "integer"
- }
- }
- },
- "fromTime": {
- "name": "from",
- "in": "query",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- },
- "toTime": {
- "name": "to",
- "in": "query",
- "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- }
- },
- "requestBodies": {
- "Device": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Device"
- }
- }
- },
- "required": true
- },
- "Permission": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Permission"
- }
- }
- },
- "required": true
- },
- "Group": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Group"
- }
- }
- },
- "required": true
- },
- "User": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/User"
- }
- }
- },
- "required": true
- },
- "Geofence": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Geofence"
- }
- }
- },
- "required": true
- },
- "Calendar": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Calendar"
- }
- }
- },
- "required": true
- },
- "Attribute": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Attribute"
- }
- }
- },
- "required": true
- },
- "Driver": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Driver"
- }
- }
- },
- "required": true
- },
- "Command": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Command"
- }
- }
- },
- "required": true
- },
- "Notification": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Notification"
- }
- }
- },
- "required": true
- },
- "Maintenance": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Maintenance"
- }
- }
- },
- "required": true
- }
- },
- "securitySchemes": {
- "basicAuth": {
- "type": "http",
- "description": "Basic HTTP authorization with _email_ and _password_",
- "scheme": "basic"
- }
- }
- }
-}
+{
+ "openapi": "3.0.1",
+ "info": {
+ "title": "Traccar",
+ "version": "5.6",
+ "description": "Traccar GPS tracking server API documentation. To use the API you need to have a server instance. For testing purposes you can use one of free [demo servers](https://www.traccar.org/demo-server/). For production use you can install your own server or get a [subscription service](https://www.traccar.org/product/tracking-server/).",
+ "contact": {
+ "name": "Traccar Support",
+ "url": "https://www.traccar.org/",
+ "email": "support@traccar.org"
+ },
+ "license": {
+ "name": "Apache 2.0",
+ "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
+ }
+ },
+ "servers": [
+ {
+ "url": "https://demo.traccar.org/api",
+ "description": "Demo Server 1"
+ },
+ {
+ "url": "https://demo2.traccar.org/api",
+ "description": "Demo Server 2"
+ },
+ {
+ "url": "https://demo3.traccar.org/api",
+ "description": "Demo Server 3"
+ },
+ {
+ "url": "https://demo4.traccar.org/api",
+ "description": "Demo Server 4"
+ },
+ {
+ "url": "https://server.traccar.org/api",
+ "description": "Subscription Server"
+ },
+ {
+ "url": "http://{host}:{port}/api",
+ "description": "Other Server",
+ "variables": {
+ "host": {
+ "default": "localhost"
+ },
+ "port": {
+ "enum": [
+ "8082",
+ "80"
+ ],
+ "default": "8082"
+ }
+ }
+ }
+ ],
+ "security": [
+ {
+ "basicAuth": []
+ }
+ ],
+ "tags": [
+ {
+ "name": "Server",
+ "description": "Server information"
+ },
+ {
+ "name": "Session",
+ "description": "User session management"
+ },
+ {
+ "name": "Devices",
+ "description": "Device management"
+ },
+ {
+ "name": "Groups",
+ "description": "Group management"
+ },
+ {
+ "name": "Users",
+ "description": "User management"
+ },
+ {
+ "name": "Permissions",
+ "description": "User permissions and other object linking"
+ },
+ {
+ "name": "Positions",
+ "description": "Retrieving raw location information"
+ },
+ {
+ "name": "Events",
+ "description": "Retrieving event information"
+ },
+ {
+ "name": "Reports",
+ "description": "Reports generation"
+ },
+ {
+ "name": "Notifications",
+ "description": "User notifications management"
+ },
+ {
+ "name": "Geofences",
+ "description": "Geofence management"
+ },
+ {
+ "name": "Commands",
+ "description": "Sending commands to devices and stored command management"
+ },
+ {
+ "name": "Attributes",
+ "description": "Computed attributes management"
+ },
+ {
+ "name": "Drivers",
+ "description": "Drivers management"
+ },
+ {
+ "name": "Maintenance",
+ "description": "Maintenance management"
+ },
+ {
+ "name": "Calendars",
+ "description": "Calendar management"
+ },
+ {
+ "name": "Statistics",
+ "description": "Retrieving server statistics"
+ }
+ ],
+ "paths": {
+ "/commands": {
+ "get": {
+ "summary": "Fetch a list of Saved Commands",
+ "tags": [
+ "Commands"
+ ],
+ "description": "Without params, it returns a list of Saved Commands the user has access to",
+ "parameters": [
+ {
+ "name": "all",
+ "in": "query",
+ "description": "Can only be used by admins or managers to fetch all entities",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "name": "userId",
+ "in": "query",
+ "description": "Standard users can use this only with their own _userId_",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "deviceId",
+ "in": "query",
+ "description": "Standard users can use this only with _deviceId_s, they have access to",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "groupId",
+ "in": "query",
+ "description": "Standard users can use this only with _groupId_s, they have access to",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "refresh",
+ "in": "query",
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Command"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "post": {
+ "summary": "Create a Saved Command",
+ "tags": [
+ "Commands"
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Command"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Command"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ }
+ },
+ "/commands/{id}": {
+ "put": {
+ "summary": "Update a Saved Command",
+ "tags": [
+ "Commands"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Command"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Command"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ },
+ "delete": {
+ "summary": "Delete a Saved Command",
+ "tags": [
+ "Commands"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "No Content",
+ "content": {}
+ }
+ }
+ }
+ },
+ "/commands/send": {
+ "get": {
+ "summary": "Fetch a list of Saved Commands supported by Device at the moment",
+ "description": "Return a list of saved commands linked to Device and its groups, filtered by current Device protocol support",
+ "tags": [
+ "Commands"
+ ],
+ "parameters": [
+ {
+ "name": "deviceId",
+ "in": "query",
+ "description": "Standard users can use this only with _deviceId_s, they have access to",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Command"
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Could happen when the user doesn't have permission for the device",
+ "content": {}
+ }
+ }
+ },
+ "post": {
+ "summary": "Dispatch commands to device",
+ "description": "Dispatch a new command or Saved Command if _body.id_ set",
+ "tags": [
+ "Commands"
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Command"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Command sent",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Command"
+ }
+ }
+ }
+ },
+ "202": {
+ "description": "Command queued",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Command"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Could happen when the user doesn't have permission or an incorrect command _type_ for the device",
+ "content": {}
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ }
+ },
+ "/commands/types": {
+ "get": {
+ "summary": "Fetch a list of available Commands for the Device or all possible Commands if Device ommited",
+ "tags": [
+ "Commands"
+ ],
+ "parameters": [
+ {
+ "name": "deviceId",
+ "in": "query",
+ "description": "Internal device identifier. Only works if device has already reported some locations",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "protocol",
+ "in": "query",
+ "description": "Protocol name. Can be used instead of device id",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "textChannel",
+ "in": "query",
+ "description": "When `true` return SMS commands. If not specified or `false` return data commands",
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/CommandType"
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Could happen when trying to fetch from a device the user does not have permission",
+ "content": {}
+ }
+ }
+ }
+ },
+ "/devices": {
+ "get": {
+ "summary": "Fetch a list of Devices",
+ "description": "Without any params, returns a list of the user's devices",
+ "tags": [
+ "Devices"
+ ],
+ "parameters": [
+ {
+ "name": "all",
+ "in": "query",
+ "description": "Can only be used by admins or managers to fetch all entities",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "name": "userId",
+ "in": "query",
+ "description": "Standard users can use this only with their own _userId_",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "id",
+ "in": "query",
+ "description": "To fetch one or more devices. Multiple params can be passed like `id=31&id=42`",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "uniqueId",
+ "in": "query",
+ "description": "To fetch one or more devices. Multiple params can be passed like `uniqueId=333331&uniqieId=44442`",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Device"
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "No permission",
+ "content": {}
+ }
+ }
+ },
+ "post": {
+ "summary": "Create a Device",
+ "tags": [
+ "Devices"
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Device"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Device"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ }
+ },
+ "/devices/{id}": {
+ "put": {
+ "summary": "Update a Device",
+ "tags": [
+ "Devices"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Device"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Device"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ },
+ "delete": {
+ "summary": "Delete a Device",
+ "tags": [
+ "Devices"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "No Content",
+ "content": {}
+ }
+ }
+ }
+ },
+ "/devices/{id}/accumulators": {
+ "put": {
+ "summary": "Update total distance and hours of the Device",
+ "tags": [
+ "Devices"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DeviceAccumulators"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "204": {
+ "description": "No Content",
+ "content": {}
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ }
+ },
+ "/groups": {
+ "get": {
+ "summary": "Fetch a list of Groups",
+ "description": "Without any params, returns a list of the Groups the user belongs to",
+ "tags": [
+ "Groups"
+ ],
+ "parameters": [
+ {
+ "name": "all",
+ "in": "query",
+ "description": "Can only be used by admins or managers to fetch all entities",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "name": "userId",
+ "in": "query",
+ "description": "Standard users can use this only with their own _userId_",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Group"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "post": {
+ "summary": "Create a Group",
+ "tags": [
+ "Groups"
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Group"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Group"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "No permission",
+ "content": {}
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ }
+ },
+ "/groups/{id}": {
+ "put": {
+ "summary": "Update a Group",
+ "tags": [
+ "Groups"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Group"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Group"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ },
+ "delete": {
+ "summary": "Delete a Group",
+ "tags": [
+ "Groups"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "No Content",
+ "content": {}
+ }
+ }
+ }
+ },
+ "/permissions": {
+ "post": {
+ "summary": "Link an Object to another Object",
+ "tags": [
+ "Permissions"
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Permission"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "204": {
+ "description": "No Content",
+ "content": {}
+ },
+ "400": {
+ "description": "No permission",
+ "content": {}
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ },
+ "delete": {
+ "summary": "Unlink an Object from another Object",
+ "tags": [
+ "Permissions"
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Permission"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "204": {
+ "description": "No Content",
+ "content": {}
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ }
+ },
+ "/positions": {
+ "get": {
+ "summary": "Fetches a list of Positions",
+ "description": "We strongly recommend using [Traccar WebSocket API](https://www.traccar.org/traccar-api/) instead of periodically polling positions endpoint. Without any params, it returns a list of last known positions for all the user's Devices. _from_ and _to_ fields are not required with _id_.",
+ "tags": [
+ "Positions"
+ ],
+ "parameters": [
+ {
+ "name": "deviceId",
+ "in": "query",
+ "description": "_deviceId_ is optional, but requires the _from_ and _to_ parameters when used",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "from",
+ "in": "query",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ }
+ },
+ {
+ "name": "to",
+ "in": "query",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ }
+ },
+ {
+ "name": "id",
+ "in": "query",
+ "description": "To fetch one or more positions. Multiple params can be passed like `id=31&id=42`",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Position"
+ }
+ }
+ },
+ "text/csv": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Position"
+ }
+ }
+ },
+ "application/gpx+xml": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Position"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/server": {
+ "get": {
+ "summary": "Fetch Server information",
+ "tags": [
+ "Server"
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Server"
+ }
+ }
+ }
+ }
+ }
+ },
+ "put": {
+ "summary": "Update Server information",
+ "tags": [
+ "Server"
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Server"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Server"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ }
+ },
+ "/session": {
+ "get": {
+ "summary": "Fetch Session information",
+ "tags": [
+ "Session"
+ ],
+ "parameters": [
+ {
+ "name": "token",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/User"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Not Found",
+ "content": {}
+ }
+ }
+ },
+ "post": {
+ "summary": "Create a new Session",
+ "tags": [
+ "Session"
+ ],
+ "requestBody": {
+ "content": {
+ "application/x-www-form-urlencoded": {
+ "schema": {
+ "required": [
+ "email",
+ "password"
+ ],
+ "properties": {
+ "email": {
+ "type": "string"
+ },
+ "password": {
+ "type": "string",
+ "format": "password"
+ }
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/User"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "content": {}
+ }
+ }
+ },
+ "delete": {
+ "summary": "Close the Session",
+ "tags": [
+ "Session"
+ ],
+ "responses": {
+ "204": {
+ "description": "No Content",
+ "content": {}
+ }
+ }
+ }
+ },
+ "/session/openid/auth": {
+ "get": {
+ "summary": "Fetch Session information",
+ "tags": [
+ "Session"
+ ],
+ "parameters": [
+ {
+ }
+ ],
+ "responses": {
+ "303": {
+ "description": "Redirect to OpenID Connect identity provider",
+ "content": { }
+ }
+ }
+ }
+ },
+ "/session/openid/callback": {
+ "get": {
+ "summary": "OpenID Callback",
+ "tags": [
+ "Session"
+ ],
+ "parameters": [
+ {
+ }
+ ],
+ "responses": {
+ "303": {
+ "description": "Successful authentication, redirect to homepage",
+ "content": { }
+ }
+ }
+ }
+ },
+ "/users": {
+ "get": {
+ "summary": "Fetch a list of Users",
+ "tags": [
+ "Users"
+ ],
+ "parameters": [
+ {
+ "name": "userId",
+ "in": "query",
+ "description": "Can only be used by admin or manager users",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/User"
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "No Permission",
+ "content": {}
+ }
+ }
+ },
+ "post": {
+ "summary": "Create a User",
+ "tags": [
+ "Users"
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/User"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/User"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ }
+ },
+ "/users/{id}": {
+ "put": {
+ "summary": "Update a User",
+ "tags": [
+ "Users"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/User"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/User"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ },
+ "delete": {
+ "summary": "Delete a User",
+ "tags": [
+ "Users"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "No Content",
+ "content": {}
+ }
+ }
+ }
+ },
+ "/notifications": {
+ "get": {
+ "summary": "Fetch a list of Notifications",
+ "description": "Without params, it returns a list of Notifications the user has access to",
+ "tags": [
+ "Notifications"
+ ],
+ "parameters": [
+ {
+ "name": "all",
+ "in": "query",
+ "description": "Can only be used by admins or managers to fetch all entities",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "name": "userId",
+ "in": "query",
+ "description": "Standard users can use this only with their own _userId_",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "deviceId",
+ "in": "query",
+ "description": "Standard users can use this only with _deviceId_s, they have access to",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "groupId",
+ "in": "query",
+ "description": "Standard users can use this only with _groupId_s, they have access to",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "refresh",
+ "in": "query",
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Notification"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "post": {
+ "summary": "Create a Notification",
+ "tags": [
+ "Notifications"
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Notification"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Notification"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ }
+ },
+ "/notifications/{id}": {
+ "put": {
+ "summary": "Update a Notification",
+ "tags": [
+ "Notifications"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Notification"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Notification"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ },
+ "delete": {
+ "summary": "Delete a Notification",
+ "tags": [
+ "Notifications"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "No Content",
+ "content": {}
+ }
+ }
+ }
+ },
+ "/notifications/types": {
+ "get": {
+ "summary": "Fetch a list of available Notification types",
+ "tags": [
+ "Notifications"
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/NotificationType"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/notifications/test": {
+ "post": {
+ "summary": "Send test notification to current user via Email and SMS",
+ "tags": [
+ "Notifications"
+ ],
+ "responses": {
+ "204": {
+ "description": "Successful sending",
+ "content": {}
+ },
+ "400": {
+ "description": "Could happen if sending has failed",
+ "content": {}
+ }
+ }
+ }
+ },
+ "/geofences": {
+ "get": {
+ "summary": "Fetch a list of Geofences",
+ "description": "Without params, it returns a list of Geofences the user has access to",
+ "tags": [
+ "Geofences"
+ ],
+ "parameters": [
+ {
+ "name": "all",
+ "in": "query",
+ "description": "Can only be used by admins or managers to fetch all entities",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "name": "userId",
+ "in": "query",
+ "description": "Standard users can use this only with their own _userId_",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "deviceId",
+ "in": "query",
+ "description": "Standard users can use this only with _deviceId_s, they have access to",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "groupId",
+ "in": "query",
+ "description": "Standard users can use this only with _groupId_s, they have access to",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "refresh",
+ "in": "query",
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Geofence"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "post": {
+ "summary": "Create a Geofence",
+ "tags": [
+ "Geofences"
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Geofence"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Geofence"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ }
+ },
+ "/geofences/{id}": {
+ "put": {
+ "summary": "Update a Geofence",
+ "tags": [
+ "Geofences"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Geofence"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Geofence"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ },
+ "delete": {
+ "summary": "Delete a Geofence",
+ "tags": [
+ "Geofences"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "No Content",
+ "content": {}
+ }
+ }
+ }
+ },
+ "/events/{id}": {
+ "get": {
+ "tags": [
+ "Events"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Event"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/reports/route": {
+ "get": {
+ "summary": "Fetch a list of Positions within the time period for the Devices or Groups",
+ "description": "At least one _deviceId_ or one _groupId_ must be passed",
+ "tags": [
+ "Reports"
+ ],
+ "parameters": [
+ {
+ "name": "deviceId",
+ "in": "query",
+ "style": "form",
+ "explode": true,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ }
+ },
+ {
+ "name": "groupId",
+ "in": "query",
+ "style": "form",
+ "explode": true,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ }
+ },
+ {
+ "name": "from",
+ "in": "query",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ }
+ },
+ {
+ "name": "to",
+ "in": "query",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Position"
+ }
+ }
+ },
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Position"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/reports/events": {
+ "get": {
+ "summary": "Fetch a list of Events within the time period for the Devices or Groups",
+ "description": "At least one _deviceId_ or one _groupId_ must be passed",
+ "tags": [
+ "Reports"
+ ],
+ "parameters": [
+ {
+ "name": "deviceId",
+ "in": "query",
+ "style": "form",
+ "explode": true,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ }
+ },
+ {
+ "name": "groupId",
+ "in": "query",
+ "style": "form",
+ "explode": true,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ }
+ },
+ {
+ "name": "type",
+ "in": "query",
+ "description": "% can be used to return events of all types",
+ "style": "form",
+ "explode": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ {
+ "name": "from",
+ "in": "query",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ }
+ },
+ {
+ "name": "to",
+ "in": "query",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Event"
+ }
+ }
+ },
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Event"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/reports/summary": {
+ "get": {
+ "summary": "Fetch a list of ReportSummary within the time period for the Devices or Groups",
+ "description": "At least one _deviceId_ or one _groupId_ must be passed",
+ "tags": [
+ "Reports"
+ ],
+ "parameters": [
+ {
+ "name": "deviceId",
+ "in": "query",
+ "style": "form",
+ "explode": true,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ }
+ },
+ {
+ "name": "groupId",
+ "in": "query",
+ "style": "form",
+ "explode": true,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ }
+ },
+ {
+ "name": "from",
+ "in": "query",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ }
+ },
+ {
+ "name": "to",
+ "in": "query",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ReportSummary"
+ }
+ }
+ },
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ReportSummary"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/reports/trips": {
+ "get": {
+ "summary": "Fetch a list of ReportTrips within the time period for the Devices or Groups",
+ "description": "At least one _deviceId_ or one _groupId_ must be passed",
+ "tags": [
+ "Reports"
+ ],
+ "parameters": [
+ {
+ "name": "deviceId",
+ "in": "query",
+ "style": "form",
+ "explode": true,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ }
+ },
+ {
+ "name": "groupId",
+ "in": "query",
+ "style": "form",
+ "explode": true,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ }
+ },
+ {
+ "name": "from",
+ "in": "query",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ }
+ },
+ {
+ "name": "to",
+ "in": "query",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ReportTrips"
+ }
+ }
+ },
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ReportTrips"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/reports/stops": {
+ "get": {
+ "summary": "Fetch a list of ReportStops within the time period for the Devices or Groups",
+ "description": "At least one _deviceId_ or one _groupId_ must be passed",
+ "tags": [
+ "Reports"
+ ],
+ "parameters": [
+ {
+ "name": "deviceId",
+ "in": "query",
+ "style": "form",
+ "explode": true,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ }
+ },
+ {
+ "name": "groupId",
+ "in": "query",
+ "style": "form",
+ "explode": true,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ }
+ },
+ {
+ "name": "from",
+ "in": "query",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ }
+ },
+ {
+ "name": "to",
+ "in": "query",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ReportStops"
+ }
+ }
+ },
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ReportStops"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/statistics": {
+ "get": {
+ "summary": "Fetch server Statistics",
+ "tags": [
+ "Statistics"
+ ],
+ "parameters": [
+ {
+ "name": "from",
+ "in": "query",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ }
+ },
+ {
+ "name": "to",
+ "in": "query",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Statistics"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/calendars": {
+ "get": {
+ "summary": "Fetch a list of Calendars",
+ "description": "Without params, it returns a list of Calendars the user has access to",
+ "tags": [
+ "Calendars"
+ ],
+ "parameters": [
+ {
+ "name": "all",
+ "in": "query",
+ "description": "Can only be used by admins or managers to fetch all entities",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "name": "userId",
+ "in": "query",
+ "description": "Standard users can use this only with their own _userId_",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Calendar"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "post": {
+ "summary": "Create a Calendar",
+ "tags": [
+ "Calendars"
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Calendar"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Calendar"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ }
+ },
+ "/calendars/{id}": {
+ "put": {
+ "summary": "Update a Calendar",
+ "tags": [
+ "Calendars"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Calendar"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Calendar"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ },
+ "delete": {
+ "summary": "Delete a Calendar",
+ "tags": [
+ "Calendars"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "No Content",
+ "content": {}
+ }
+ }
+ }
+ },
+ "/attributes/computed": {
+ "get": {
+ "summary": "Fetch a list of Attributes",
+ "description": "Without params, it returns a list of Attributes the user has access to",
+ "tags": [
+ "Attributes"
+ ],
+ "parameters": [
+ {
+ "name": "all",
+ "in": "query",
+ "description": "Can only be used by admins or managers to fetch all entities",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "name": "userId",
+ "in": "query",
+ "description": "Standard users can use this only with their own _userId_",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "deviceId",
+ "in": "query",
+ "description": "Standard users can use this only with _deviceId_s, they have access to",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "groupId",
+ "in": "query",
+ "description": "Standard users can use this only with _groupId_s, they have access to",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "refresh",
+ "in": "query",
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Attribute"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "post": {
+ "summary": "Create an Attribute",
+ "tags": [
+ "Attributes"
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Attribute"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Attribute"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ }
+ },
+ "/attributes/computed/{id}": {
+ "put": {
+ "summary": "Update an Attribute",
+ "tags": [
+ "Attributes"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Attribute"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Attribute"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ },
+ "delete": {
+ "summary": "Delete an Attribute",
+ "tags": [
+ "Attributes"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "No Content",
+ "content": {}
+ }
+ }
+ }
+ },
+ "/drivers": {
+ "get": {
+ "summary": "Fetch a list of Drivers",
+ "description": "Without params, it returns a list of Drivers the user has access to",
+ "tags": [
+ "Drivers"
+ ],
+ "parameters": [
+ {
+ "name": "all",
+ "in": "query",
+ "description": "Can only be used by admins or managers to fetch all entities",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "name": "userId",
+ "in": "query",
+ "description": "Standard users can use this only with their own _userId_",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "deviceId",
+ "in": "query",
+ "description": "Standard users can use this only with _deviceId_s, they have access to",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "groupId",
+ "in": "query",
+ "description": "Standard users can use this only with _groupId_s, they have access to",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "refresh",
+ "in": "query",
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Driver"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "post": {
+ "summary": "Create a Driver",
+ "tags": [
+ "Drivers"
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Driver"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Driver"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ }
+ },
+ "/drivers/{id}": {
+ "put": {
+ "summary": "Update a Driver",
+ "tags": [
+ "Drivers"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Driver"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Driver"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ },
+ "delete": {
+ "summary": "Delete a Driver",
+ "tags": [
+ "Drivers"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "No Content",
+ "content": {}
+ }
+ }
+ }
+ },
+ "/maintenance": {
+ "get": {
+ "summary": "Fetch a list of Maintenance",
+ "description": "Without params, it returns a list of Maintenance the user has access to",
+ "tags": [
+ "Maintenance"
+ ],
+ "parameters": [
+ {
+ "name": "all",
+ "in": "query",
+ "description": "Can only be used by admins or managers to fetch all entities",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "name": "userId",
+ "in": "query",
+ "description": "Standard users can use this only with their own _userId_",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "deviceId",
+ "in": "query",
+ "description": "Standard users can use this only with _deviceId_s, they have access to",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "groupId",
+ "in": "query",
+ "description": "Standard users can use this only with _groupId_s, they have access to",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "refresh",
+ "in": "query",
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Maintenance"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "post": {
+ "summary": "Create a Maintenance",
+ "tags": [
+ "Maintenance"
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Maintenance"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Maintenance"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ }
+ },
+ "/maintenance/{id}": {
+ "put": {
+ "summary": "Update a Maintenance",
+ "tags": [
+ "Maintenance"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Maintenance"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Maintenance"
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name": "body"
+ },
+ "delete": {
+ "summary": "Delete a Maintenance",
+ "tags": [
+ "Maintenance"
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "No Content",
+ "content": {}
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Position": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "deviceId": {
+ "type": "integer"
+ },
+ "protocol": {
+ "type": "string"
+ },
+ "deviceTime": {
+ "type": "string",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "format": "date-time"
+ },
+ "fixTime": {
+ "type": "string",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "format": "date-time"
+ },
+ "serverTime": {
+ "type": "string",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "format": "date-time"
+ },
+ "outdated": {
+ "type": "boolean"
+ },
+ "valid": {
+ "type": "boolean"
+ },
+ "latitude": {
+ "type": "number"
+ },
+ "longitude": {
+ "type": "number"
+ },
+ "altitude": {
+ "type": "number"
+ },
+ "speed": {
+ "type": "number",
+ "description": "in knots"
+ },
+ "course": {
+ "type": "number"
+ },
+ "address": {
+ "type": "string"
+ },
+ "accuracy": {
+ "type": "number"
+ },
+ "network": {
+ "type": "object",
+ "properties": {}
+ },
+ "attributes": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ },
+ "User": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ },
+ "email": {
+ "type": "string"
+ },
+ "phone": {
+ "type": "string"
+ },
+ "readonly": {
+ "type": "boolean"
+ },
+ "administrator": {
+ "type": "boolean"
+ },
+ "map": {
+ "type": "string"
+ },
+ "latitude": {
+ "type": "number"
+ },
+ "longitude": {
+ "type": "number"
+ },
+ "zoom": {
+ "type": "integer"
+ },
+ "password": {
+ "type": "string"
+ },
+ "twelveHourFormat": {
+ "type": "boolean"
+ },
+ "coordinateFormat": {
+ "type": "string"
+ },
+ "disabled": {
+ "type": "boolean"
+ },
+ "expirationTime": {
+ "type": "string",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "format": "date-time"
+ },
+ "deviceLimit": {
+ "type": "integer"
+ },
+ "userLimit": {
+ "type": "integer"
+ },
+ "deviceReadonly": {
+ "type": "boolean"
+ },
+ "limitCommands": {
+ "type": "boolean"
+ },
+ "poiLayer": {
+ "type": "string"
+ },
+ "attributes": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ },
+ "Server": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "registration": {
+ "type": "boolean"
+ },
+ "readonly": {
+ "type": "boolean"
+ },
+ "deviceReadonly": {
+ "type": "boolean"
+ },
+ "limitCommands": {
+ "type": "boolean"
+ },
+ "map": {
+ "type": "string"
+ },
+ "bingKey": {
+ "type": "string"
+ },
+ "mapUrl": {
+ "type": "string"
+ },
+ "poiLayer": {
+ "type": "string"
+ },
+ "latitude": {
+ "type": "number"
+ },
+ "longitude": {
+ "type": "number"
+ },
+ "zoom": {
+ "type": "integer"
+ },
+ "twelveHourFormat": {
+ "type": "boolean"
+ },
+ "version": {
+ "type": "string"
+ },
+ "forceSettings": {
+ "type": "boolean"
+ },
+ "coordinateFormat": {
+ "type": "string"
+ },
+ "openIdEnabled": {
+ "type": "boolean"
+ },
+ "openIdForce": {
+ "type": "boolean"
+ },
+ "attributes": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ },
+ "Command": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "deviceId": {
+ "type": "integer"
+ },
+ "description": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string"
+ },
+ "attributes": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ },
+ "Device": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ },
+ "uniqueId": {
+ "type": "string"
+ },
+ "status": {
+ "type": "string"
+ },
+ "disabled": {
+ "type": "boolean"
+ },
+ "lastUpdate": {
+ "type": "string",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "format": "date-time"
+ },
+ "positionId": {
+ "type": "integer"
+ },
+ "groupId": {
+ "type": "integer"
+ },
+ "phone": {
+ "type": "string"
+ },
+ "model": {
+ "type": "string"
+ },
+ "contact": {
+ "type": "string"
+ },
+ "category": {
+ "type": "string"
+ },
+ "geofenceIds": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ },
+ "attributes": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ },
+ "Group": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ },
+ "groupId": {
+ "type": "integer"
+ },
+ "attributes": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ },
+ "Permission": {
+ "type": "object",
+ "properties": {
+ "userId": {
+ "type": "integer",
+ "description": "User Id, can be only first parameter"
+ },
+ "deviceId": {
+ "type": "integer",
+ "description": "Device Id, can be first parameter or second only in combination with userId"
+ },
+ "groupId": {
+ "type": "integer",
+ "description": "Group Id, can be first parameter or second only in combination with userId"
+ },
+ "geofenceId": {
+ "type": "integer",
+ "description": "Geofence Id, can be second parameter only"
+ },
+ "notificationId": {
+ "type": "integer",
+ "description": "Notification Id, can be second parameter only"
+ },
+ "calendarId": {
+ "type": "integer",
+ "description": "Calendar Id, can be second parameter only and only in combination with userId"
+ },
+ "attributeId": {
+ "type": "integer",
+ "description": "Computed Attribute Id, can be second parameter only"
+ },
+ "driverId": {
+ "type": "integer",
+ "description": "Driver Id, can be second parameter only"
+ },
+ "managedUserId": {
+ "type": "integer",
+ "description": "User Id, can be second parameter only and only in combination with userId"
+ }
+ },
+ "description": "This is a permission map that contain two object indexes. It is used to link/unlink objects. Order is important. Example: { deviceId:8, geofenceId: 16 }"
+ },
+ "CommandType": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string"
+ }
+ }
+ },
+ "Geofence": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ },
+ "area": {
+ "type": "string"
+ },
+ "calendarId": {
+ "type": "integer"
+ },
+ "attributes": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ },
+ "Notification": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "type": {
+ "type": "string"
+ },
+ "always": {
+ "type": "boolean"
+ },
+ "web": {
+ "type": "boolean"
+ },
+ "mail": {
+ "type": "boolean"
+ },
+ "sms": {
+ "type": "boolean"
+ },
+ "calendarId": {
+ "type": "integer"
+ },
+ "attributes": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ },
+ "NotificationType": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string"
+ }
+ }
+ },
+ "Event": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "type": {
+ "type": "string"
+ },
+ "eventTime": {
+ "type": "string",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "format": "date-time"
+ },
+ "deviceId": {
+ "type": "integer"
+ },
+ "positionId": {
+ "type": "integer"
+ },
+ "geofenceId": {
+ "type": "integer"
+ },
+ "maintenanceId": {
+ "type": "integer"
+ },
+ "attributes": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ },
+ "ReportSummary": {
+ "type": "object",
+ "properties": {
+ "deviceId": {
+ "type": "integer"
+ },
+ "deviceName": {
+ "type": "string"
+ },
+ "maxSpeed": {
+ "type": "number",
+ "description": "in knots"
+ },
+ "averageSpeed": {
+ "type": "number",
+ "description": "in knots"
+ },
+ "distance": {
+ "type": "number",
+ "description": "in meters"
+ },
+ "spentFuel": {
+ "type": "number",
+ "description": "in liters"
+ },
+ "engineHours": {
+ "type": "integer"
+ }
+ }
+ },
+ "ReportTrips": {
+ "type": "object",
+ "properties": {
+ "deviceId": {
+ "type": "integer"
+ },
+ "deviceName": {
+ "type": "string"
+ },
+ "maxSpeed": {
+ "type": "number",
+ "description": "in knots"
+ },
+ "averageSpeed": {
+ "type": "number",
+ "description": "in knots"
+ },
+ "distance": {
+ "type": "number",
+ "description": "in meters"
+ },
+ "spentFuel": {
+ "type": "number",
+ "description": "in liters"
+ },
+ "duration": {
+ "type": "integer"
+ },
+ "startTime": {
+ "type": "string",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "format": "date-time"
+ },
+ "startAddress": {
+ "type": "string"
+ },
+ "startLat": {
+ "type": "number"
+ },
+ "startLon": {
+ "type": "number"
+ },
+ "endTime": {
+ "type": "string",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "format": "date-time"
+ },
+ "endAddress": {
+ "type": "string"
+ },
+ "endLat": {
+ "type": "number"
+ },
+ "endLon": {
+ "type": "number"
+ },
+ "driverUniqueId": {
+ "type": "integer"
+ },
+ "driverName": {
+ "type": "string"
+ }
+ }
+ },
+ "ReportStops": {
+ "type": "object",
+ "properties": {
+ "deviceId": {
+ "type": "integer"
+ },
+ "deviceName": {
+ "type": "string"
+ },
+ "duration": {
+ "type": "integer"
+ },
+ "startTime": {
+ "type": "string",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "format": "date-time"
+ },
+ "address": {
+ "type": "string"
+ },
+ "lat": {
+ "type": "number"
+ },
+ "lon": {
+ "type": "number"
+ },
+ "endTime": {
+ "type": "string",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "format": "date-time"
+ },
+ "spentFuel": {
+ "type": "number",
+ "description": "in liters"
+ },
+ "engineHours": {
+ "type": "integer"
+ }
+ }
+ },
+ "Statistics": {
+ "type": "object",
+ "properties": {
+ "captureTime": {
+ "type": "string",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "format": "date-time"
+ },
+ "activeUsers": {
+ "type": "integer"
+ },
+ "activeDevices": {
+ "type": "integer"
+ },
+ "requests": {
+ "type": "integer"
+ },
+ "messagesReceived": {
+ "type": "integer"
+ },
+ "messagesStored": {
+ "type": "integer"
+ }
+ }
+ },
+ "DeviceAccumulators": {
+ "type": "object",
+ "properties": {
+ "deviceId": {
+ "type": "integer"
+ },
+ "totalDistance": {
+ "type": "number",
+ "description": "in meters"
+ },
+ "hours": {
+ "type": "number"
+ }
+ }
+ },
+ "Calendar": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ },
+ "data": {
+ "type": "string",
+ "description": "base64 encoded in iCalendar format"
+ },
+ "attributes": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ },
+ "Attribute": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "description": {
+ "type": "string"
+ },
+ "attribute": {
+ "type": "string"
+ },
+ "expression": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string",
+ "description": "String|Number|Boolean"
+ }
+ }
+ },
+ "Driver": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ },
+ "uniqueId": {
+ "type": "string"
+ },
+ "attributes": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ },
+ "Maintenance": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string"
+ },
+ "start": {
+ "type": "number"
+ },
+ "period": {
+ "type": "number"
+ },
+ "attributes": {
+ "type": "object",
+ "properties": {}
+ }
+ }
+ }
+ },
+ "parameters": {
+ "entityId": {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "all": {
+ "name": "all",
+ "in": "query",
+ "description": "Can only be used by admins or managers to fetch all entities",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ "refresh": {
+ "name": "refresh",
+ "in": "query",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ "userId": {
+ "name": "userId",
+ "in": "query",
+ "description": "Standard users can use this only with their own _userId_",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "deviceId": {
+ "name": "deviceId",
+ "in": "query",
+ "description": "Standard users can use this only with _deviceId_s, they have access to",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "groupId": {
+ "name": "groupId",
+ "in": "query",
+ "description": "Standard users can use this only with _groupId_s, they have access to",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "deviceIdArray": {
+ "name": "deviceId",
+ "in": "query",
+ "style": "form",
+ "explode": true,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ }
+ },
+ "groupIdArray": {
+ "name": "groupId",
+ "in": "query",
+ "style": "form",
+ "explode": true,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ }
+ },
+ "fromTime": {
+ "name": "from",
+ "in": "query",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ }
+ },
+ "toTime": {
+ "name": "to",
+ "in": "query",
+ "description": "in IS0 8601 format. eg. `1963-11-22T18:30:00Z`",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ }
+ }
+ },
+ "requestBodies": {
+ "Device": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Device"
+ }
+ }
+ },
+ "required": true
+ },
+ "Permission": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Permission"
+ }
+ }
+ },
+ "required": true
+ },
+ "Group": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Group"
+ }
+ }
+ },
+ "required": true
+ },
+ "User": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/User"
+ }
+ }
+ },
+ "required": true
+ },
+ "Geofence": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Geofence"
+ }
+ }
+ },
+ "required": true
+ },
+ "Calendar": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Calendar"
+ }
+ }
+ },
+ "required": true
+ },
+ "Attribute": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Attribute"
+ }
+ }
+ },
+ "required": true
+ },
+ "Driver": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Driver"
+ }
+ }
+ },
+ "required": true
+ },
+ "Command": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Command"
+ }
+ }
+ },
+ "required": true
+ },
+ "Notification": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Notification"
+ }
+ }
+ },
+ "required": true
+ },
+ "Maintenance": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Maintenance"
+ }
+ }
+ },
+ "required": true
+ }
+ },
+ "securitySchemes": {
+ "basicAuth": {
+ "type": "http",
+ "description": "Basic HTTP authorization with _email_ and _password_",
+ "scheme": "basic"
+ }
+ }
+ }
+}