1 Reply Latest reply on Sep 12, 2015 3:06 AM by Graham Macleod

    rest api and jquery

    Graham Macleod

      Has anyone tried interacting with the rest api through jquery?

       

      I'm trying to log in but the response back from the server is that it's not a POST request.

       

      here is my code.

       

      $(document).ready(function() {

          $("#login").click(function(){

              $.ajax({ type: 'POST',

                              url: "https://MYSERVER/api/2.0/auth/signin",

                              data: "<tsRequest><credentials name=\"USER\" password=\"\" ><site contentUrl=\"SITE\" /></credentials></tsRequest>",

                              contentType: "text/xml",

                              dataType: "xml",

                              cache: false,

                              error: function() { alert("No data found."); },

                              success: function(xml) {

                                  alert("it works");

                              }

              });

          });

      });