Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Found this content helpful? Log in or sign up to leave a like!
Hi all,
We have a few external tools set up for our institution with test and production instances. We have them set up so that in TEST Canvas Cloud instance, the external tools point to the test instance of the tool. I'm having to remove and (re)set up the external tools in TEST Canvas Cloud instance every three weeks when data gets refreshed from production. Is there a way to prevent this? I have followed the "Test Environment Setting Examples" in Canvas LMS REST API Documentation. But it doesn't seem to work. Maybe I'm doing it all wrong. Has anyone had success with this or any other method? if so, would you mind sharing?
Thanks!
Kumi
Hi @hagimotk ,
I have never tried the "Test Environment Setting Examples" in the Canvas LMS REST API Documentation. I am going to have to do some testing and see if I can get that to work.
I'm not sure how practical this would be with your specific tool and how you develop, but you could redirect the tool based on the custom_canvas_api_domain value that is passed with the tool launch. Something like:
if (custom_canvas_api_domain === institution.instructure.com) {
go to live tool code
} else {
go to test tool code
}
I typically create a development version of the LTI tool within a sandbox course in Canvas to do my development. That way it is always directed at my TEST version. This doesn't work however if you are testing a tool across multiple courses. Depending on the purpose of the tool, I will occasionally make course ID's or other information into hard coded variables so I can test it as if it were coming from other courses.
These are just a few ideas but I would love to hear of anyone else's approach to this problem.
Thanks Kenneth, for the reply and ideas! It didn't occur to me to create a development version altogether with hard-coded variables. I'll definitely try that.
As for the custom_canvas_api_domain value, since I've already re-setup the tools on my test/beta instances after the last weekend refresh, I'll have to wait until the next refresh to see what value I get. I have a feeling that it's going to return the same production domain URL, since all those LTI settings are in the database and that all gets refreshed... but I'll report back with results after the next refresh happens.
Kumi
The custom_canvas_api_domain should list the API domain not the tool domain. Examples: institution.instructure.com, institution.test.instructure.com, institution.beta.instructure.com. You can use this as a variable to make API calls for a tool that spans multiple institutions or in this case your different Canvas instances.
Thanks for the correction. You're right - I was confusing it with the domain url for the tools in the tool config XML. custom_canvas_api_domain should stay across refresh.
Hello Kenneth,
Were you able to get environment section of the XML to work? I have been working with it for a couple of days without any luck. I can tell you that I have the launch_url pointing to my dev server that is hosting my software and the domain point to the Canvas site that the user will be coming from. Any help would be appreciated?
Thank you,
Shawn
@srg25 , the domain field in the XML should be the domain of your dev server as well. You don't need to put anything into the XML about where the user is coming from, Canvas will send that information when the LTI tool is launched. Here is an example of XML from one of the tools that I use if that will help:
<?xml version="1.0" encoding="UTF-8"?>
<cartridge_basiclti_link xmlns="http://www.imsglobal.org/xsd/imslticc_v1p0"
xmlns:blti = "http://www.imsglobal.org/xsd/imsbasiclti_v1p0"
xmlns:lticm ="http://www.imsglobal.org/xsd/imslticm_v1p0"
xmlns:lticp ="http://www.imsglobal.org/xsd/imslticp_v1p0"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "http://www.imsglobal.org/xsd/imslticc_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticc_v1p0.xsd
http://www.imsglobal.org/xsd/imsbasiclti_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imsbasiclti_v1p0.xsd
http://www.imsglobal.org/xsd/imslticm_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticm_v1p0.xsd
http://www.imsglobal.org/xsd/imslticp_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticp_v1p0.xsd">
<blti:title>Title of my tool</blti:title>
<blti:description>Description of the tool</blti:description>
<blti:icon>No ICO</blti:icon>
<blti:launch_url>https://elearn.usu.edu/path_to_file/controller.php</blti:launch_url>
<blti:extensions platform="canvas.instructure.com">
<lticm:property name="tool_id">something_sort_of_id</lticm:property>
<lticm:property name="privacy_level">public</lticm:property>
<lticm:property name="domain">elearn.usu.edu</lticm:property>
<lticm:options name="course_navigation">
<lticm:property name="url">https://elearn.usu.edu/path_to_file/controller.php</lticm:property>
<lticm:property name="text">Title of my tool</lticm:property>
<lticm:property name="visibility">admins</lticm:property>
<lticm:property name="default">enabled</lticm:property>
<lticm:property name="enabled">true</lticm:property>
</lticm:options>
</blti:extensions>
<cartridge_bundle identifierref="BLTI001_Bundle"/>
<cartridge_icon identifierref="BLTI001_Icon"/>
</cartridge_basiclti_link>
Thank you Kenneth for the information. I have my LTI launches working without the environments section of the XML. I don't see the environment section in your XML either. I'm assuming that you weren't able to get that working for your LTI launches either.
Thank you,
Shawn
I have never tried using the environment section in the XML (nor did I even know there was an environment section). There used to be a cool form you could use to generate the XML for an LTI tool in Canvas at https://lti-examples.heroku.com/build_xml.html, but it appears to be no longer in service. I used it for quite some time because I knew nothing about the XML for an LTI tool and this is what it created. The only variations I take are visibility, enabled/disabled and the location for where the tool is loaded.
I found where they moved the page to help generate XML for LTI Tools in Canvas. It is now found at XML Config Builder.
I have an update -
The environment section in my XML is working now. To confirm that, after the weekend TEST refresh, I did the following:
curl -X GET 'https://[institution].test.instructure.com/api/v1/accounts/[account_id]/external_tools/[external_too...' \
-H "Authorization: Bearer ACCESS_TOKEN"
The domain and launch URL returned (JSON) was correctly pointing to the test instance of our tool.
I still had to do this:
curl -X PUT 'https://[institution].test.instructure.com/api/v1/accounts/[account_id]/external_tools/[external_too...' \
-H "Authorization: Bearer ACCESS_TOKEN" \
-F 'shared_secret=SHARED_SECRET_FOR_TEST_INSTANCE_OF_THE_TOOL'
- only because we have a different shared secret for prod and test tools on our end. If your tool uses the same shared secret across instances, I imagine the tool will just work without having to do anything after the environment section is added to the tool config.
Kumi
Can you provide the xml configuration you used to get this to work? I haven't had any luck with it.
Chris
We have this working successfully now:
In the XML file, the following line under <lticm:options name="course_navigation"> needs to be removed (if present):
<lticm:property name="url">PRODUCTION_URL</lticm:property>
The following needs to be added to XML files in order to use the environment variables:
<lticm:options name="environments">
<lticm:property name="launch_url">URL_FOR_PRODUCTION_GOES_HERE</lticm:property>
<lticm:property name="domain">PRODUCTION_DOMAIN</lticm:property>
<lticm:property name="test_launch_url">URL_FOR_TEST_GOES_HERE</lticm:property>
<lticm:property name="test_domain">TEST_DOMAIN</lticm:property>
<lticm:property name="beta_launch_url">URL_FOR_BETA_GOES_HERE</lticm:property>
<lticm:property name="beta_domain">BETA_DOMAIN</lticm:property>
</lticm:options>
That's great agschmid, thank you immensely for sharing your solution!
hi agschmid ,
This is good.
Assume you using the same LTI credentials across all tool environments? Have you figured out any solutions wherein we can use different credentials?
Cheers
Chetan
hi Chetan,
This is using the same LTI credentials across all tool environments. I don't think it's possible to use different credentials since you only input them once for production.
Andrea
To participate in the Instructure Community, you need to sign up or log in:
Sign In