Account account = getRequestConfig().getAccountStore().getByClientId(request.getApiClientId());
if (account == null) {
throw ApiException.notFound("Account not found given client id " + request.getApiClientId());
}
ApiClient apiClient = account.getApiClientById(request.getApiClientId());
if (apiClient == null) {
throw ApiException.notFound("API client not found for " + request.getApiClientId());
}
if (request.getPushType().isNotification()) {
String path = String.format("manage/api-client/%s/notifications/%s", apiClient.getClientName(), id);
return Response.seeOther(new URI(path)).build();
} else if (request.getPushType().isUserEvent()) {
String deviceId = request.getUserEventPush().getDeviceId();
String path = String.format("manage/api-client/%s/user-events/%s", apiClient.getClientName(), deviceId);
return Response.seeOther(new URI(path)).build();
}
}