GET API call "using sis_course_id:" 404 Error

bertscjn1
Community Explorer

I am trying to make GET calls to Canvas but when I try to get the data using the sis_course_id: it doesn't work - I get a 404 error. However, if I replace the sis_course_id: with the numerical ID number Canvas automatically generates then the call is made without issue. Any ideas what I'm possibly doing wrong?

Right now I'm just trying to log the data in the Console before I try to inject it into my HTML document. 

Doesn't Work:
https://[my_domain]/api/v1/courses/sis_course_id:[sis_ course_ID]?access_token=[my_access_token]

Does Work:
https://[my_domain]/api/v1/courses/[numerical_Course_ID]?access_token=[my_access_token] 

Here's my code:

<script>

function courseSearchID(){
    var x = document.getElementById("courseName").value;
    console.log(x);

    fetch('https://[my_domain]/api/v1/courses/sis_course_id:[sis_ course_ID]?access_token=[my_access_token]")
        .then(response => response.json())
        .then(json => console.log(json))
    };
</script>

0 Likes