AnsweredAssumed Answered

How do you call the API from an exteral server?

Question asked by Travis Jones on Jul 9, 2015
Latest reply on Sep 2, 2015 by Kimberly Kopplien

I have an LTI tool working on a secure server.

I'm trying to GET a specific Assignment with Jquery ajax so I can PUT it back with an update to the external_tool_tag_attributes: { url:



            type: "GET",            // Type of request to be send

            url: canvasapi,          // Url+token to which the request is sent

            contentType: "application/json; charset=utf-8",

            dataType: "jsonp",     // type of data

            success: function(data, status, jqXHR)


                console.log( "success status: "+status );

                console.log( "success data: "+data );

                console.log( "success xhr text: "+jqXHR.responseText );


            jsonp: false,            // should use Callback below

            jsonpCallback: function(data)


                //var asgndata = JSON.parse(data);// or //json_decode(data);

                //console.log( "jsonp asgndata: "+asgndata );

                console.log( "jsonp data: "+data );// undefined  parser error in their return data


            error: function (jqXHR, status)


                console.log( "ERR status: "+status ); // parser error

                console.log( "ERR xhr text: "+jqXHR.responseText );// undefined



But it returns with errors:

Screen Shot 2015-07-09 at 11.01.38 AM.png

I can paste the url+token in the browser and it returns what I need.

I've tried other API calls with no success.


What is the best way to call the API from an external server?