1
0
-1

Hi There

I'm using the DX cloud version and am wanting to access a JSON API via ajax from the web browser of a signed in user.

The specific JSON API is the data list API: https://kiwicivil.cloud.joget.com/jw/web/json/data/list/kc1/equipmentList

eg:

$.ajax({
  type: "POST",
  url: 'https://kiwicivil.cloud.joget.com/jw/web/json/data/list/kc1/equipmentList',
  success: function(res) {
    console.log(res);
  },
  dataType: "jsonp",
  cache: false
});


If I am logged in as the administrator, then this work fine.

However if I am logged in as another user, then I get a 403 response.


If I include a data element,  eg: 

data: {
  j_username : 'admin',
  j_password : 'xxxx',
  loginAs : 'xxxxx'
},

Then joget changes the login for the entire browser session.


Is there any way that I can access the JSON API as an existing signed in user without it returning a 403 error?


Cheers

Dave


    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      Hi Anders

      Thanks for this, I missed the significance of that in the documentation. That would explain why the JSON call only worked when logged in as admin.

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi, according to the docs JSON API#web/json/data/list/(*:appId)/(*:listId) that API is for the admin role. If you need something different, you can use the API Builder to build your custom APIs.

          CommentAdd your comment...