Outcomes Import API: Add endpoint to query migration issues

The content migrations for outcomes importing are not scoped to an account
or a course, since the academic benchmarks standards are imported globally
per shard.

Fixes CNVS-21782

Test Plan:

    1.  Kick off an outcomes import task
        - curl -H 'Authorization: Bearer <api-key>'
            --data 'guid=<some-guid>'
            'http://<canv-domain>/api/v1/global/outcomes_import'
    2.  Query it through this endpoint and make sure it works
        - curl -H 'Authorization: Bearer <api-key>'
            'http://<canv-domain>/api/v1/global/outcomes_import/migration_status/<migration-id>'

Change-Id: I8ff3a5206bb7aa5f97d615912c60341fedcaf855
Reviewed-on: https://gerrit.instructure.com/58034
Tested-by: Jenkins
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Benjamin Porter <bporter@instructure.com>
This commit is contained in:
Benjamin Porter 2015-07-08 13:50:17 -06:00
parent 3c532c13a3
commit 49a779c715
2 changed files with 13 additions and 0 deletions

View File

@ -18,6 +18,7 @@
class OutcomesImportApiController < ApplicationController
include Api::V1::Outcome
include Api::V1::ContentMigration
before_filter :require_user, :can_manage_global_outcomes, :has_api_config
@ -48,6 +49,17 @@ class OutcomesImportApiController < ApplicationController
end
end
def migration_status
return render json: { error: "must specify a migration id" } unless params[:migration_id]
begin
cm = ContentMigration.find(params[:migration_id])
render json: content_migration_json(cm, @current_user, session)
rescue ActiveRecord::RecordNotFound => e
render json: { error: "no content migration matching id #{params[:migration_id]}" }
end
end
protected
def can_manage_global_outcomes

View File

@ -1572,6 +1572,7 @@ CanvasRails::Application.routes.draw do
# get "global/outcomes_import/list/:guid", action: :list
get "global/outcomes_import/available", action: :available
post "global/outcomes_import", action: :create
get "global/outcomes_import/migration_status/:migration_id", action: :migration_status
end
scope(controller: :group_categories) do