How do I load this AJAX REST API request?

0 favourites
  • 1 posts
  • Hi folks, I'm trying to return data from a REST API on my system. I've tried a few different combinations, but I'm not sure I'm even in the ballpark.

    If someone has some pointers it would be appreciated.

    I *HAVE* looked at the AJAX component in the manual, but it didn't help, and I can literally only find one example of an AJAX setup in the tutorials that also wasn't helpful.

    Here's the info from the documentation on the API call. My issue revolves around the authentication/header issue. I do get a connection, but I get 'Not Authorized'.

    Retrieve All data from specific module

    $.ajax({

    dataType : "json",

    url :

    'http://yourdomain.com/sximoapi?module=employee',

    headers : {"Authorization": "Basic " +

    btoa("superadmin@mail.com:pLihtt-I4jzL")},

    success : function(data){

    // Do return value here //

    } })

    View Detail data from specific module

    $.ajax({

    dataType : "json",

    type : "GET",

    url :

    'http://yourdomain.com/sximoapi/1?module=employee',

    headers : {"Authorization": "Basic " +

    btoa("superadmin@mail.com:pLihtt-I4jzL")},

    success : function(data){

    // Do return value here //

    } })

    Here's what I've tried in C3.

    Ajax.SetRequestHeader

    "headers : {Authorization: Basic btoa(superadmin@mail.com:vbzt9Q-mZT7K-G8fTmm-pKezp)}"

    Ajax.SetRequestHeader

    Header ""Authorization"

    Value "Basic"

    (Didn't know where to put the id!)

    I know the btoa encrypts the ID but don't know how to manage that either.

    Any guidance?

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)