2018-09-29 22:34:47 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-05-14 12:33:31 +00:00
|
|
|
module API
|
2020-10-15 00:08:42 +00:00
|
|
|
class API < ::API::Base
|
2014-12-19 14:15:29 +00:00
|
|
|
include APIGuard
|
2017-01-30 17:41:56 +00:00
|
|
|
|
2017-09-07 05:41:15 +00:00
|
|
|
LOG_FILENAME = Rails.root.join("log", "api_json.log")
|
|
|
|
|
2019-05-05 10:19:14 +00:00
|
|
|
NO_SLASH_URL_PART_REGEX = %r{[^/]+}.freeze
|
2018-11-08 12:18:17 +00:00
|
|
|
NAMESPACE_OR_PROJECT_REQUIREMENTS = { id: NO_SLASH_URL_PART_REGEX }.freeze
|
|
|
|
COMMIT_ENDPOINT_REQUIREMENTS = NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(sha: NO_SLASH_URL_PART_REGEX).freeze
|
2019-01-31 10:13:23 +00:00
|
|
|
USER_REQUIREMENTS = { user_id: NO_SLASH_URL_PART_REGEX }.freeze
|
2019-07-12 19:13:28 +00:00
|
|
|
LOG_FILTERS = ::Rails.application.config.filter_parameters + [/^output$/]
|
2021-10-14 00:12:08 +00:00
|
|
|
LOG_FORMATTER = Gitlab::GrapeLogging::Formatters::LogrageWithTimestamp.new
|
2017-09-23 13:21:32 +00:00
|
|
|
|
2018-05-18 06:48:59 +00:00
|
|
|
insert_before Grape::Middleware::Error,
|
|
|
|
GrapeLogging::Middleware::RequestLogger,
|
|
|
|
logger: Logger.new(LOG_FILENAME),
|
2021-10-14 00:12:08 +00:00
|
|
|
formatter: LOG_FORMATTER,
|
2018-05-18 06:48:59 +00:00
|
|
|
include: [
|
2019-07-12 19:13:28 +00:00
|
|
|
GrapeLogging::Loggers::FilterParameters.new(LOG_FILTERS),
|
2019-08-20 18:12:28 +00:00
|
|
|
Gitlab::GrapeLogging::Loggers::ClientEnvLogger.new,
|
2018-09-03 17:03:32 +00:00
|
|
|
Gitlab::GrapeLogging::Loggers::RouteLogger.new,
|
2018-05-26 04:00:26 +00:00
|
|
|
Gitlab::GrapeLogging::Loggers::UserLogger.new,
|
2019-11-11 15:06:42 +00:00
|
|
|
Gitlab::GrapeLogging::Loggers::ExceptionLogger.new,
|
2018-09-04 17:14:22 +00:00
|
|
|
Gitlab::GrapeLogging::Loggers::QueueDurationLogger.new,
|
2018-12-05 20:54:40 +00:00
|
|
|
Gitlab::GrapeLogging::Loggers::PerfLogger.new,
|
2020-05-15 18:07:52 +00:00
|
|
|
Gitlab::GrapeLogging::Loggers::CorrelationIdLogger.new,
|
2020-10-26 21:08:22 +00:00
|
|
|
Gitlab::GrapeLogging::Loggers::ContextLogger.new,
|
2021-10-19 12:12:07 +00:00
|
|
|
Gitlab::GrapeLogging::Loggers::ContentLogger.new,
|
|
|
|
Gitlab::GrapeLogging::Loggers::UrgencyLogger.new
|
2018-05-18 06:48:59 +00:00
|
|
|
]
|
2017-09-07 05:41:15 +00:00
|
|
|
|
2017-06-20 07:40:24 +00:00
|
|
|
allow_access_with_scope :api
|
2021-02-02 18:09:42 +00:00
|
|
|
allow_access_with_scope :read_api, if: -> (request) { request.get? || request.head? }
|
2017-07-25 09:35:45 +00:00
|
|
|
prefix :api
|
2017-06-20 07:40:24 +00:00
|
|
|
|
2017-01-30 17:41:56 +00:00
|
|
|
version 'v3', using: :path do
|
2018-05-15 13:39:33 +00:00
|
|
|
route :any, '*path' do
|
|
|
|
error!('API V3 is no longer supported. Use API V4 instead.', 410)
|
|
|
|
end
|
2017-01-30 17:41:56 +00:00
|
|
|
end
|
2012-07-04 07:48:00 +00:00
|
|
|
|
2018-05-15 13:39:33 +00:00
|
|
|
version 'v4', using: :path
|
|
|
|
|
2017-11-01 09:25:49 +00:00
|
|
|
before do
|
|
|
|
header['X-Frame-Options'] = 'SAMEORIGIN'
|
|
|
|
header['X-Content-Type-Options'] = 'nosniff'
|
|
|
|
end
|
2017-05-04 02:05:38 +00:00
|
|
|
|
2020-01-03 15:08:33 +00:00
|
|
|
before do
|
2020-06-29 21:09:07 +00:00
|
|
|
coerce_nil_params_to_array!
|
|
|
|
|
2021-10-14 00:12:08 +00:00
|
|
|
api_endpoint = request.env[Grape::Env::API_ENDPOINT]
|
2020-10-26 18:08:27 +00:00
|
|
|
feature_category = api_endpoint.options[:for].try(:feature_category_for_app, api_endpoint).to_s
|
|
|
|
|
2021-10-14 00:12:08 +00:00
|
|
|
# remote_ip is added here and the ContextLogger so that the
|
|
|
|
# client_id field is set correctly, as the user object does not
|
|
|
|
# survive between multiple context pushes.
|
2020-01-03 15:08:33 +00:00
|
|
|
Gitlab::ApplicationContext.push(
|
2020-03-06 18:08:08 +00:00
|
|
|
user: -> { @current_user },
|
2020-01-03 15:08:33 +00:00
|
|
|
project: -> { @project },
|
2020-01-23 15:08:46 +00:00
|
|
|
namespace: -> { @group },
|
2021-03-12 00:09:18 +00:00
|
|
|
runner: -> { @current_runner || @runner },
|
2021-01-05 21:10:22 +00:00
|
|
|
remote_ip: request.ip,
|
2021-10-14 00:12:08 +00:00
|
|
|
caller_id: api_endpoint.endpoint_id,
|
2020-10-26 18:08:27 +00:00
|
|
|
feature_category: feature_category
|
2020-01-03 15:08:33 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2020-08-18 18:10:10 +00:00
|
|
|
before do
|
|
|
|
set_peek_enabled_for_current_request
|
|
|
|
end
|
|
|
|
|
2021-02-14 09:09:06 +00:00
|
|
|
after do
|
|
|
|
Gitlab::UsageDataCounters::VSCodeExtensionActivityUniqueCounter.track_api_request_when_trackable(user_agent: request&.user_agent, user: @current_user)
|
|
|
|
end
|
|
|
|
|
2022-02-01 21:12:02 +00:00
|
|
|
after do
|
|
|
|
Gitlab::UsageDataCounters::JetBrainsPluginActivityUniqueCounter.track_api_request_when_trackable(user_agent: request&.user_agent, user: @current_user)
|
|
|
|
end
|
|
|
|
|
2022-03-31 06:08:34 +00:00
|
|
|
after do
|
|
|
|
Gitlab::UsageDataCounters::GitLabCliActivityUniqueCounter.track_api_request_when_trackable(user_agent: request&.user_agent, user: @current_user)
|
|
|
|
end
|
|
|
|
|
2017-08-02 16:20:31 +00:00
|
|
|
# The locale is set to the current user's locale when `current_user` is loaded
|
2017-05-25 15:22:45 +00:00
|
|
|
after { Gitlab::I18n.use_default_locale }
|
2016-11-22 09:04:23 +00:00
|
|
|
|
2016-06-23 15:14:31 +00:00
|
|
|
rescue_from Gitlab::Access::AccessDeniedError do
|
|
|
|
rack_response({ 'message' => '403 Forbidden' }.to_json, 403)
|
|
|
|
end
|
|
|
|
|
2012-07-05 15:12:09 +00:00
|
|
|
rescue_from ActiveRecord::RecordNotFound do
|
2015-02-03 04:36:54 +00:00
|
|
|
rack_response({ 'message' => '404 Not found' }.to_json, 404)
|
2012-07-05 15:12:09 +00:00
|
|
|
end
|
|
|
|
|
2019-06-21 16:56:47 +00:00
|
|
|
rescue_from(
|
|
|
|
::ActiveRecord::StaleObjectError,
|
|
|
|
::Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError
|
|
|
|
) do
|
2018-11-23 16:25:11 +00:00
|
|
|
rack_response({ 'message' => '409 Conflict: Resource lock' }.to_json, 409)
|
|
|
|
end
|
|
|
|
|
2018-04-03 16:47:33 +00:00
|
|
|
rescue_from UploadedFile::InvalidPathError do |e|
|
|
|
|
rack_response({ 'message' => e.message }.to_json, 400)
|
|
|
|
end
|
|
|
|
|
|
|
|
rescue_from ObjectStorage::RemoteStoreError do |e|
|
|
|
|
rack_response({ 'message' => e.message }.to_json, 500)
|
|
|
|
end
|
|
|
|
|
2016-08-02 21:56:27 +00:00
|
|
|
# Retain 405 error rather than a 500 error for Grape 0.15.0+.
|
2017-01-04 17:24:39 +00:00
|
|
|
# https://github.com/ruby-grape/grape/blob/a3a28f5b5dfbb2797442e006dbffd750b27f2a76/UPGRADING.md#changes-to-method-not-allowed-routes
|
|
|
|
rescue_from Grape::Exceptions::MethodNotAllowed do |e|
|
|
|
|
error! e.message, e.status, e.headers
|
|
|
|
end
|
|
|
|
|
2016-08-02 21:56:27 +00:00
|
|
|
rescue_from Grape::Exceptions::Base do |e|
|
|
|
|
error! e.message, e.status, e.headers
|
2016-07-29 10:14:36 +00:00
|
|
|
end
|
|
|
|
|
2017-02-17 11:52:27 +00:00
|
|
|
rescue_from Gitlab::Auth::TooManyIps do |e|
|
2017-02-17 13:44:57 +00:00
|
|
|
rack_response({ 'message' => '403 Forbidden' }.to_json, 403)
|
2017-02-17 11:52:27 +00:00
|
|
|
end
|
|
|
|
|
2013-02-01 09:42:02 +00:00
|
|
|
rescue_from :all do |exception|
|
2016-08-19 00:06:33 +00:00
|
|
|
handle_api_exception(exception)
|
2013-01-29 17:20:59 +00:00
|
|
|
end
|
|
|
|
|
2020-04-30 21:09:47 +00:00
|
|
|
# This is a specific exception raised by `rack-timeout` gem when Puma
|
|
|
|
# requests surpass its timeout. Given it inherits from Exception, we
|
|
|
|
# should rescue it separately. For more info, see:
|
|
|
|
# - https://github.com/sharpstone/rack-timeout/blob/master/doc/exceptions.md
|
|
|
|
# - https://github.com/ruby-grape/grape#exception-handling
|
|
|
|
rescue_from Rack::Timeout::RequestTimeoutException do |exception|
|
|
|
|
handle_api_exception(exception)
|
|
|
|
end
|
|
|
|
|
2021-10-13 03:12:30 +00:00
|
|
|
rescue_from RateLimitedService::RateLimitedError do |exception|
|
|
|
|
exception.log_request(context.request, context.current_user)
|
|
|
|
rack_response({ 'message' => { 'error' => exception.message } }.to_json, 429, exception.headers)
|
|
|
|
end
|
|
|
|
|
2012-06-27 11:32:56 +00:00
|
|
|
format :json
|
2020-07-16 21:10:05 +00:00
|
|
|
formatter :json, Gitlab::Json::GrapeFormatter
|
2021-01-20 12:11:06 +00:00
|
|
|
content_type :json, 'application/json'
|
2020-10-23 09:08:41 +00:00
|
|
|
|
2016-04-15 15:35:40 +00:00
|
|
|
# Ensure the namespace is right, otherwise we might load Grape::API::Helpers
|
|
|
|
helpers ::API::Helpers
|
2017-05-04 12:11:15 +00:00
|
|
|
helpers ::API::Helpers::CommonHelpers
|
2020-08-18 18:10:10 +00:00
|
|
|
helpers ::API::Helpers::PerformanceBarHelpers
|
2021-10-13 03:12:30 +00:00
|
|
|
helpers ::API::Helpers::RateLimiter
|
2016-04-15 15:35:40 +00:00
|
|
|
|
2020-02-10 15:08:54 +00:00
|
|
|
namespace do
|
|
|
|
after do
|
2020-04-07 21:09:46 +00:00
|
|
|
::Users::ActivityService.new(@current_user).execute
|
2020-02-10 15:08:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# Keep in alphabetical order
|
|
|
|
mount ::API::AccessRequests
|
2020-05-13 21:08:55 +00:00
|
|
|
mount ::API::Admin::Ci::Variables
|
2020-07-17 00:09:37 +00:00
|
|
|
mount ::API::Admin::InstanceClusters
|
2021-03-03 06:11:13 +00:00
|
|
|
mount ::API::Admin::PlanLimits
|
2020-03-03 15:08:08 +00:00
|
|
|
mount ::API::Admin::Sidekiq
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::Appearance
|
|
|
|
mount ::API::Applications
|
|
|
|
mount ::API::Avatar
|
|
|
|
mount ::API::AwardEmoji
|
|
|
|
mount ::API::Badges
|
|
|
|
mount ::API::Boards
|
|
|
|
mount ::API::Branches
|
|
|
|
mount ::API::BroadcastMessages
|
2021-07-05 12:08:33 +00:00
|
|
|
mount ::API::BulkImports
|
2021-07-20 21:09:52 +00:00
|
|
|
mount ::API::Ci::JobArtifacts
|
|
|
|
mount ::API::Ci::Jobs
|
2020-07-11 00:09:17 +00:00
|
|
|
mount ::API::Ci::Pipelines
|
|
|
|
mount ::API::Ci::PipelineSchedules
|
2021-09-21 00:09:28 +00:00
|
|
|
mount ::API::Ci::ResourceGroups
|
2020-06-26 00:09:13 +00:00
|
|
|
mount ::API::Ci::Runner
|
|
|
|
mount ::API::Ci::Runners
|
2022-01-26 09:14:20 +00:00
|
|
|
mount ::API::Ci::SecureFiles
|
2021-07-20 21:09:52 +00:00
|
|
|
mount ::API::Ci::Triggers
|
|
|
|
mount ::API::Ci::Variables
|
2022-04-13 15:08:16 +00:00
|
|
|
mount ::API::Clusters::Agents
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::Commits
|
|
|
|
mount ::API::CommitStatuses
|
2020-03-30 09:07:58 +00:00
|
|
|
mount ::API::ContainerRegistryEvent
|
2020-10-30 12:08:44 +00:00
|
|
|
mount ::API::ContainerRepositories
|
2020-11-13 21:09:31 +00:00
|
|
|
mount ::API::DependencyProxy
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::DeployKeys
|
2020-02-20 03:08:57 +00:00
|
|
|
mount ::API::DeployTokens
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::Deployments
|
|
|
|
mount ::API::Environments
|
2021-09-27 21:09:27 +00:00
|
|
|
mount ::API::ErrorTracking::ClientKeys
|
|
|
|
mount ::API::ErrorTracking::Collector
|
|
|
|
mount ::API::ErrorTracking::ProjectSettings
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::Events
|
2020-10-07 12:09:12 +00:00
|
|
|
mount ::API::FeatureFlags
|
|
|
|
mount ::API::FeatureFlagsUserLists
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::Features
|
|
|
|
mount ::API::Files
|
2020-05-15 12:08:28 +00:00
|
|
|
mount ::API::FreezePeriods
|
2021-06-17 18:10:22 +00:00
|
|
|
mount ::API::Geo
|
2021-06-09 15:10:05 +00:00
|
|
|
mount ::API::GroupAvatar
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::GroupBoards
|
|
|
|
mount ::API::GroupClusters
|
|
|
|
mount ::API::GroupExport
|
2020-02-11 09:08:39 +00:00
|
|
|
mount ::API::GroupImport
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::GroupLabels
|
|
|
|
mount ::API::GroupMilestones
|
|
|
|
mount ::API::Groups
|
|
|
|
mount ::API::GroupContainerRepositories
|
2021-07-26 21:08:38 +00:00
|
|
|
mount ::API::GroupDebianDistributions
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::GroupVariables
|
2020-07-06 18:09:13 +00:00
|
|
|
mount ::API::ImportBitbucketServer
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::ImportGithub
|
2020-08-21 09:10:08 +00:00
|
|
|
mount ::API::IssueLinks
|
2020-11-05 00:09:16 +00:00
|
|
|
mount ::API::Invitations
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::Issues
|
|
|
|
mount ::API::Keys
|
|
|
|
mount ::API::Labels
|
|
|
|
mount ::API::Lint
|
|
|
|
mount ::API::Markdown
|
|
|
|
mount ::API::Members
|
|
|
|
mount ::API::MergeRequestDiffs
|
|
|
|
mount ::API::MergeRequests
|
2020-07-10 21:09:29 +00:00
|
|
|
mount ::API::MergeRequestApprovals
|
2020-04-14 18:09:54 +00:00
|
|
|
mount ::API::Metrics::Dashboard::Annotations
|
2020-05-13 18:08:47 +00:00
|
|
|
mount ::API::Metrics::UserStarredDashboards
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::Namespaces
|
|
|
|
mount ::API::Notes
|
|
|
|
mount ::API::Discussions
|
|
|
|
mount ::API::ResourceLabelEvents
|
2020-05-26 15:08:17 +00:00
|
|
|
mount ::API::ResourceMilestoneEvents
|
2020-07-16 21:10:05 +00:00
|
|
|
mount ::API::ResourceStateEvents
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::NotificationSettings
|
2020-07-17 06:09:11 +00:00
|
|
|
mount ::API::ProjectPackages
|
|
|
|
mount ::API::GroupPackages
|
|
|
|
mount ::API::PackageFiles
|
2020-12-04 15:09:36 +00:00
|
|
|
mount ::API::NugetProjectPackages
|
2020-12-29 12:10:19 +00:00
|
|
|
mount ::API::NugetGroupPackages
|
2020-07-17 06:09:11 +00:00
|
|
|
mount ::API::PypiPackages
|
|
|
|
mount ::API::ComposerPackages
|
2020-09-15 21:09:35 +00:00
|
|
|
mount ::API::ConanProjectPackages
|
|
|
|
mount ::API::ConanInstancePackages
|
2020-09-28 09:09:35 +00:00
|
|
|
mount ::API::DebianGroupPackages
|
|
|
|
mount ::API::DebianProjectPackages
|
2020-07-17 06:09:11 +00:00
|
|
|
mount ::API::MavenPackages
|
2020-11-11 12:09:06 +00:00
|
|
|
mount ::API::NpmProjectPackages
|
|
|
|
mount ::API::NpmInstancePackages
|
2020-08-27 15:10:21 +00:00
|
|
|
mount ::API::GenericPackages
|
2020-07-17 06:09:11 +00:00
|
|
|
mount ::API::GoProxy
|
2021-05-28 09:10:41 +00:00
|
|
|
mount ::API::HelmPackages
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::Pages
|
|
|
|
mount ::API::PagesDomains
|
|
|
|
mount ::API::ProjectClusters
|
|
|
|
mount ::API::ProjectContainerRepositories
|
2021-06-14 18:10:28 +00:00
|
|
|
mount ::API::ProjectDebianDistributions
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::ProjectEvents
|
|
|
|
mount ::API::ProjectExport
|
|
|
|
mount ::API::ProjectImport
|
|
|
|
mount ::API::ProjectHooks
|
|
|
|
mount ::API::ProjectMilestones
|
2020-05-15 09:07:59 +00:00
|
|
|
mount ::API::ProjectRepositoryStorageMoves
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::Projects
|
|
|
|
mount ::API::ProjectSnapshots
|
|
|
|
mount ::API::ProjectSnippets
|
|
|
|
mount ::API::ProjectStatistics
|
|
|
|
mount ::API::ProjectTemplates
|
2020-04-01 12:08:00 +00:00
|
|
|
mount ::API::Terraform::State
|
2020-09-21 00:09:47 +00:00
|
|
|
mount ::API::Terraform::StateVersion
|
2021-05-14 00:11:05 +00:00
|
|
|
mount ::API::Terraform::Modules::V1::Packages
|
2020-10-31 06:09:06 +00:00
|
|
|
mount ::API::PersonalAccessTokens
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::ProtectedBranches
|
|
|
|
mount ::API::ProtectedTags
|
|
|
|
mount ::API::Releases
|
|
|
|
mount ::API::Release::Links
|
|
|
|
mount ::API::RemoteMirrors
|
|
|
|
mount ::API::Repositories
|
2021-01-29 21:09:34 +00:00
|
|
|
mount ::API::ResourceAccessTokens
|
2021-02-10 15:11:19 +00:00
|
|
|
mount ::API::RubygemPackages
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::Search
|
2021-09-30 18:11:31 +00:00
|
|
|
mount ::API::Integrations
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::Settings
|
|
|
|
mount ::API::SidekiqMetrics
|
2020-12-23 15:09:54 +00:00
|
|
|
mount ::API::SnippetRepositoryStorageMoves
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::Snippets
|
|
|
|
mount ::API::Statistics
|
|
|
|
mount ::API::Submodules
|
|
|
|
mount ::API::Subscriptions
|
|
|
|
mount ::API::Suggestions
|
|
|
|
mount ::API::SystemHooks
|
|
|
|
mount ::API::Tags
|
|
|
|
mount ::API::Templates
|
|
|
|
mount ::API::Todos
|
2021-11-12 09:10:03 +00:00
|
|
|
mount ::API::Topics
|
2020-09-30 12:09:53 +00:00
|
|
|
mount ::API::Unleash
|
2020-09-10 12:08:54 +00:00
|
|
|
mount ::API::UsageData
|
2021-03-25 18:09:07 +00:00
|
|
|
mount ::API::UsageDataQueries
|
2021-04-06 06:09:00 +00:00
|
|
|
mount ::API::UsageDataNonSqlMetrics
|
2020-02-10 15:08:54 +00:00
|
|
|
mount ::API::UserCounts
|
|
|
|
mount ::API::Users
|
|
|
|
mount ::API::Version
|
|
|
|
mount ::API::Wikis
|
|
|
|
end
|
|
|
|
|
2019-09-03 22:07:49 +00:00
|
|
|
mount ::API::Internal::Base
|
2020-10-01 12:10:14 +00:00
|
|
|
mount ::API::Internal::Lfs
|
2019-09-06 04:06:25 +00:00
|
|
|
mount ::API::Internal::Pages
|
2020-07-20 09:09:22 +00:00
|
|
|
mount ::API::Internal::Kubernetes
|
2022-01-06 06:10:35 +00:00
|
|
|
mount ::API::Internal::MailRoom
|
2022-02-02 00:18:16 +00:00
|
|
|
mount ::API::Internal::ContainerRegistry::Migration
|
2016-10-07 13:39:57 +00:00
|
|
|
|
2020-09-01 12:11:01 +00:00
|
|
|
version 'v3', using: :path do
|
|
|
|
# Although the following endpoints are kept behind V3 namespace,
|
|
|
|
# they're not deprecated neither should be removed when V3 get
|
|
|
|
# removed. They're needed as a layer to integrate with Jira
|
|
|
|
# Development Panel.
|
|
|
|
namespace '/', requirements: ::API::V3::Github::ENDPOINT_REQUIREMENTS do
|
|
|
|
mount ::API::V3::Github
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-04-05 12:10:23 +00:00
|
|
|
route :any, '*path', feature_category: :not_owned do # rubocop:todo Gitlab/AvoidFeatureCategoryNotOwned
|
2016-10-07 17:18:02 +00:00
|
|
|
error!('404 Not Found', 404)
|
2016-10-07 13:39:57 +00:00
|
|
|
end
|
2012-06-27 11:32:56 +00:00
|
|
|
end
|
2012-06-27 09:26:16 +00:00
|
|
|
end
|
2019-09-13 13:26:31 +00:00
|
|
|
|
2021-05-11 21:10:21 +00:00
|
|
|
API::API.prepend_mod
|