Activity Feed
- Got a Kudo for Re: Ideas for creating a Certificate of Completion. 03-22-2022 12:00 PM
- Got a Kudo for Re: Student Enrollment Report. 01-13-2022 11:21 AM
- Got a Kudo for Re: Course name is Unnamed even if I supply name argument. 08-06-2020 02:02 AM
- Got a Kudo for Re: How can I display an alert if student is on certain IP address?. 08-06-2020 02:00 AM
- Got a Kudo for Re: How can I display an alert if student is on certain IP address?. 08-06-2020 02:00 AM
- Got a Kudo for Re: How can I display an alert if student is on certain IP address?. 08-06-2020 02:00 AM
- Got a Kudo for Re: I need to edit text on a global page, how do I do that?. 08-06-2020 02:00 AM
- Got a Kudo for Re: Inserting user submissions. 08-06-2020 02:00 AM
- Got a Kudo for Re: Student Enrollment Report. 08-06-2020 02:00 AM
- Got a Kudo for Re: Prevent users from copying a course?. 08-06-2020 01:59 AM
- Got a Kudo for Re: Extra nav buttons in New UI?. 08-06-2020 01:59 AM
- Got a Kudo for Re: API - Edit functions in .net. 08-06-2020 01:59 AM
- Got a Kudo for Re: Custom Java Issue. 08-06-2020 01:59 AM
- Got a Kudo for Re: Powershell Script Issue. 08-06-2020 01:59 AM
- Got a Kudo for Re: Course Assignments in a Term . 08-06-2020 01:58 AM
- Got a Kudo for Re: Error when creating pages with Canvas API. 08-06-2020 01:58 AM
- Got a Kudo for Re: Ideas for creating a Certificate of Completion. 11-27-2019 11:47 AM
- Got a Kudo for Re: Ideas for creating a Certificate of Completion. 11-27-2019 11:47 AM
- Got a Kudo for Re: Ideas for creating a Certificate of Completion. 10-09-2019 06:24 AM
- Got a Kudo for Re: Course name is Unnamed even if I supply name argument. 09-27-2019 09:40 PM
My Posts
Post Details | Date Published | Views | Kudos |
---|
09-27-2019
10:41 AM
1 Kudo
Hi nmajethiya, The course values need to be within a course object, indicated in the API documentation with the course[ ] notation. So your JSON data should look something like this: { "course" : { "name" : "API Development Using NodeJS" , "course_code" : 1 , "start_at" : "2019-09-27T11:43:36.174Z" , "end_at" : "2019-10-27T11:43:36.174Z" , "license" : "private" , "is_public" : true , "is_public_to_auth_users" : false , "public_syllabus" : true , "public_syllabus_to_auth" : false , "public_description" : "This course will help you to learn how to create APIs using NodeJS. If you know the basics of NodeJS, this course will help you to create standard APIs" , "allow_student_wiki_edits" : false , "allow_wiki_comments" : true , "allow_student_forum_attachments" : true , "open_enrollment" : true , "self_enrollment" : true , "restrict_enrollments_to_course_dates" : true , "term_id" : 1 , "sis_course_id" : 1 , "integration_id" : 1 , "hide_final_grades" : true , "apply_assignment_group_weights" : true , "time_zone" : "Asia/Kolkata" , "default_view" : "feed" , "syllabus_body" : "This is dummy syllabus body" } , "offer" : true , "enroll_me" : true , "enable_sis_reactivation" : false } Alex
... View more
06-06-2019
02:44 PM
Hi @kristin_bayless , There are two areas of concern I would consider. The first is any potential intellectual property and copyright violations. If you are using content from a textbook or any other source, you may be violating a contract, terms of service, or other policy by "freely" distributing the content. It could also be a violation of your own school's policy depending on how it defines ownership for institutionally or teacher created content. The second, and more pressing, is the likely FERPA (or other privacy law) violation. If the "People" page is visible in the course, anyone with the link to the course can view all the members of the course including teachers and students. When we create public courses for my institution, they are only informational courses and do not have any officially enrolled students. Alex
... View more
10-27-2017
04:03 PM
It looks like there has been some progress on this idea. I found that there is now a "Late Policy" API endpoint: Late Policy - Canvas LMS REST API Documentation
... View more
10-20-2017
12:06 PM
5 Kudos
Hi carmen.windsor, As @James mentioned, this is possible with JavaScript. Here is a quick snippet that will do the trick: $( '#assignments' ).prepend('<br /><p>These grades are provisional and subject to ratification by the Board.</p>'); You should probably also include some URL validation so it only appears on the Grades page, as I imagine that the ID 'assignments' isn't unique to the page thus will add the text on other pages where it isn't desired. Alex
... View more
10-20-2017
10:18 AM
3 Kudos
This is most likely the actual API call from your script be adding to the user's page view records. This will probably need a little more research, but I think a way to verify if the page view is an API or not is to check if the 'user_agent' is NULL or the 'action' or 'URL' contains API in the string. For example: function getIpAddress () { $.getJSON( "/api/v1/users/self/page_views", function( data ){ foreach(i = 0; i < data.length; i++){ if(data[i].user_agent != NULL){ var myIpAddress = data[i].remote_ip.toString(); $.cookie("my_ip_address", myIpAddress, {path: '/'}); return; } } ); }
... View more
10-18-2017
10:50 AM
9 Kudos
Hi @dkpatton I did a quick test, and it seems that my theory was correct. Here is the script I used for testing: $.getJSON( "/api/v1/users/self/page_views", function( data ){ alert(data[0].remote_ip); } ); This only displays the user's IP address in the alert box, but it should give you a base for your code. I will also note that this is using jQuery, but since Canvas is dependent on jQuery, you shouldn't need to load any additional libraries. Alex
... View more
10-18-2017
10:32 AM
3 Kudos
Hi @dkpatton , I believe that you could make a GET request to /api/v1/users/self/page_views via Javascript and then get the IP address (remote_ip) from the first PageView object returned (the entries are in chronological order starting with the most recent). Because the user is already logged into Canvas when this script runs, you don't need to worry about an access token or authentication. Alex
... View more
09-25-2017
09:21 AM
9 Kudos
Hi @kevinw , The course object can include the number of student enrollments in a course by adding the parameter include[]=total_students. The full endpoint would be something like this: GET /api/v1/courses/:id?include[]=total_students OR GET /api/v1/accounts/:account_id/courses/:id?include[]=total_students The json that is returned will then include a 'total_students' value that will be the number of active enrollments in the course. The full documentation is here: Courses - Canvas LMS REST API Documentation Alex
... View more
08-08-2017
11:04 AM
3 Kudos
Hi @maguire , It is possible to masquerade as a user via the API if you have their user id or SIS id. It is explained here: Masquerading - Canvas LMS REST API Documentation. Using this you can use the submission API to submit assignments on the students' behalf. You could also grade and comment on the instructor's behalf. Alex
... View more
04-20-2017
11:20 AM
11 Kudos
Hi tross and @kona , Here is the PHP code: <?php require_once("fpdf181/fpdf.php"); $pdf = new FPDF('L', 'in', 'Letter'); $pdf->AddPage(); $pdf->SetMargins(0, 0); $pdf->Image('images/cert.png', 0, 0, 11, 8.5); $pdf->ln(2.45); $pdf->setFont('Times', 'B', 24); $pdf->SetX(5.45); $pdf->Cell(4.5, 1, date('F j, Y', time()), 0, 1, 'L'); $pdf->setFont('Times', 'B', 24); $pdf->SetXY(5, 4.15); $pdf->MultiCell(5, .75, $_POST['custom_user_name'], 0, 'C'); $pdf->setFont('Times', 'B', 18); $pdf->SetXY(5, 5.9); $pdf->MultiCell(5, .75, $_POST['custom_course_name'], 0, 'C'); $pdf->ln(.5); $pdf->output(); ?> The LTI is setup is as follows: Name (Whatever you want) Consumer key Shared Secret (Doesn't matter; script doesn't use it) (Doesn't matter; script doesn't use it) Launch URL (Whatever the URL for the script is) Domain Privacy Anonoymous Custom Fields user_name=$Person.name.full course_name=$Canvas.course.name Description (Whatever you want) After that, you will be able to add it to a course module under the 'External Tools' option.
... View more
04-19-2017
03:23 PM
7 Kudos
Hi @jenny_hopf , We too had a need to have a certificate for certain courses, so I created a simple LTI tool that dynamically creates a PDF certificate with the student name, course name and completion date. This tool requires a server with PHP and the FPDF library as well as setting up the tool in Canvas. The code will require some customization in order to adjust the text as necessary (based on how you want the certificate to look). The customization isn't anything too difficult, but you will want to read the examples and tutorials for FPDF. If you are interested, I can share the code and the setup for the LTI in Canvas. Alex
... View more
06-10-2016
10:41 AM
3 Kudos
Hi Michael, I suggest printing out the response from Canvas after your PUT. It should return the complete quiz object that you just updated, or an error message if there was an error. I think this should help to give you a starting point on what the problem is. Alex
... View more
04-19-2016
09:59 AM
Tricia, I think you are right the problem is the '<' specially the fact that '<' is not a proper character for a URL. You will need to use -data--urlencode instead of -d. -data--urlencode "wiki_page[body]=<p><a href=' https://googledrive.com/host/0B7BTX-Tq5LgHQUhDTEdHb0hDcDQ/Bacterial%20Grow%20Lab.htm ' >Bacteria Grow Lab</a></p>" I believe that is the right syntax. There is more information in man curl if you want to check it out yourself. Let me know if this works. Alex
... View more
04-18-2016
11:11 AM
2 Kudos
Hi Tricia, I think the problem with: -d wiki_page[body]=“<p><a href=" https://googledrive.com/host/0B7BTX-Tq5LgHQUhDTEdHb0hDcDQ/Bacterial%20Grow%20Lab.htm ">Bacteria Grow Lab</a></p>” Is the clashing double quotes. It should work it you change the inner double quotes with single quotes: -d wiki_page[body]=“<p><a href=' https://googledrive.com/host/0B7BTX-Tq5LgHQUhDTEdHb0hDcDQ/Bacterial%20Grow%20Lab.htm' >Bacteria Grow Lab</a></p>” Let me know if this fixes things. Alex
... View more
04-12-2016
02:59 PM
2 Kudos
Hi Pam, @MattHanes is right in that the code will display that error message if something goes wrong when during the POST request. In order to get a more meaningful error message, add something like this (changes in bold 😞 ###### Some functions $status_log_path = $logPath+$term+"-"+$t+"-status.log" write-host $status_log_path Try { $results1 = (Invoke-WebRequest -Headers $headers -InFile $inFile -Method POST -ContentType $contentType -Uri $url) #-PassThru -OutFile $outputPath$t"-status.log" $results1.Content | Out-File $status_log_path $results = ($results1.Content | ConvertFrom-Json) Write-Host $results } Catch [system.exception]{ $results = $null Write-Host $_.Exception } I should note that I don't use PowerShell very often, so I'm not 100% sure this is correct, but based on some research, this should output the error encountered. Alex
... View more
04-08-2016
02:03 PM
3 Kudos
Hi Marissa, This is just a possible suggestion after a quick look at your code, but I think updating the displayLinks function should do the trick. Here is the updated code (changes in bold) function displayLinks(element, index, array) { displayVals += '<li>'; displayVals += '<a href="' + element.key + '" target='_blank'>' + element.val + '</a>'; displayVals += '</li>'; } Adding the 'target' attribute to a link tells the web browser where to open the link when clicked. The '_blank' target is a new window or tab. There is also a helpful discussion about adding content to the menus for the new UI here: Has anyone been working on scripts for the new Beta UI? If this doesn't work, let me know and I will do a more thorough analysis of your code. Alex
... View more
03-28-2016
11:01 AM
2 Kudos
Hi Anthony, Assuming the user in question has Admin permissions (only admins can create courses), you can create a new Admin role with "Manage ( add / edit / delete ) courses" permissions disabled. If you have a question about creating new roles, please read this guide: How do I create account-level roles? I will also mention this idea: " modifiedtitle="true" title="In Permissions, Separate Manage (add/edit/delete) courses into 3 permissions, which is currently in the "Gathering Info" phase that proposes that the three permissions be separated. I mention this in case you want an Admin role that needs to edit courses, but not create a new courses. Alex
... View more
03-28-2016
10:47 AM
3 Kudos
Hi Anthony, Here are a few discussions you may find useful: Adding Navigation - This has a tool that allows you to add links to the New UI Has anyone been working on scripts for the new Beta UI? - This has some JavaScript that allows you to add links Alex
... View more
03-17-2016
01:54 PM
3 Kudos
Hey Jason, From my understanding of the API, there isn't a quick way to limit courses to a specific term. You have to get the list of courses you want to work with, and then manually determine which ones are for the term you are looking for. That is what I did for a few scripts I wrote. Here is some quick psuedo code for what I understand you want to do: term_id //The id of the term you want to work with courses[] = GET /api/v1/accounts/:account_id/courses //Get all the courses for account you want to work with, replace :account_id with the id of the account foreach courses as course //Iterate through each course if course->enrollment_term_id == term_id //Check if current courses has the desired term assignments[] = GET /api/v1/courses/course->id/assignments //If course has desired term, get assignments foreach assignments as assignment //Iterate through each assignment PUT /api/v1/courses/course->id/assignments/assignment->id ... //Update assignment with desired parameters This is code is just quick and messy, but I hope it can get you started. I put the variables in bold text to make it a little easier to read. If you have any questions, I will try to help out. Alex
... View more