Reading app properties from the app

Options

How can we read the app properties defined in the app profile in OTAG within the app?

Comments

  • I believe you can achieve that with the AppWorks Settings API.

  • A couple of things the swagger doc doesn't make explicit:

    1. The key is <your app name>.<your setting name>. For example, if your app is demo_1.0.zip, and you have llama.default=http://llama.com in app.properties, then you would GET gateway/v2/settings/demo.llama.
    2. You need to provide authentication to GET a setting. To do this:

      for mobile apps, add an http header called otagtoken with the value of the javascript variable otag.auth.otagtoken

      for Gateway web apps, include /webaccess/js/otag.js, and use otag.ajax() instead of jquery.ajax(); this wrapper sets the header for you

  • Thank you John this last part of getting the token is what I was missing.

  • While I was able to work directly with jquery.ajax, it looks like I cannot access otag.ajax. All I get is:

    Object # has no method 'ajax'

    Is it possible that I need to reference other js files other than jquery and otag.js?

  • Otag.js is currently just for web apps; mobile html5 apps should use $.ajax for now.