Sunday, 14 December 2014

Using BPM REST API from an external UI

6 comments:

  1. Hi again Tony, clearly I'm doing something wrong and I may sound dumb. I can't seem to make it work.

    I configured nginx server instance to listen on port 8091, started node app, started nginx server, and finally pointed my browser to http://localhost:8091/bpm_sdk/index.html, ultimately failing with an error ("Cannot get "/bpm_sdk/index.html").

    What am I missing? Can you please point me to right direction?

    Thanks for your help.

    Cheers
    Ricardo

    ReplyDelete
  2. I found the index.html that has the web service link on it - have uploaded that to the git repository just now.

    Okay, if you have nginx running and you are receiving a 'cannot get /bpm_sdk/index.html', then I suspect either the nginx.conf is not quite right or the location of the bpm_sdk folder is not in the www location that nginx is expecting it to be in. On my Mac, the www folder is located at: /private/var/www
    The nginx.conf file I have contains the following:

    worker_processes 1;
    events {
    worker_connections 1024;
    }

    http {
    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;

    server {
    listen 8091;
    server_name localhost;

    location / {
    root html;
    index index.html index.htm;
    }

    # redirect server error pages to the static page /50x.html
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root html;
    }
    }
    }

    If nginx is running and the bpm_sdk folder is in the correct location and your 'node bpm-sdk.js' is running, then when your web browser requests 'localhost:8091/bpm_sdk/index.html' it should re-route to 'localhost:8091/bpm_sdk/index.html#/viewMyTasks' and you should see the outline of the screen (doesn't matter if it cannot connect to BPM Server, it'll still render the screen).

    nginx should output to error.log and access.log files, do they contain anything helpful?

    thanks tony

    ReplyDelete
    Replies
    1. Tony, after following your instructions I managed to make it work. Thank you.

      Just a minor correction. Since angularJS includes jQuery Lite (jqLite), which offers limited functionality, class name selectors are not supported. This means that $(".ace-tab") instruction should be modified to angular.element(document.querySelector('.ace-tab')). Other than that it worked as advertised.

      On another topic, and regarding REST API, is it possible to get Coach definitions (e.g. which controls it contains) from a Human Service?

      Cheers
      Ricardo

      Delete
    2. Hi Ricardo,

      great news that you got it working!

      yes, the $(".ace-tab") code was left-over from something else that I was looking into doing. Basically, highlighting the Active tab. You can safely delete that code and you won't get the errors in the Console window or as you say switch it out to not use jQuery but AngularJS code.

      Sadly, after BPM v7.5 you can no longer get the structure of the BPM Coaches (you used to be able to & I once wrote a BPMWiki article on how to get this meta-data and re-render it on mobile devices). Hence, the need to either use Responsive Coaches embedded in an iFrame in a native mobile app or to use the REST API and an external UI as defined in this presentation.

      hope that helps,

      thanks

      tony

      Delete
    3. Hi Tony,

      That's a bummer but thanks for the info.

      Thank you again for all the help and keep these articles coming :)

      Cheers
      Ricardo

      Delete
  3. I believe this article/website will disappear on March 31st...
    Here is an article I wrote back in 2012 that did get the Coach structure via the REST API:
    http://wiki.bpmwiki.com/display/samples/Mobile+BPM+%28Android+Sample%29
    and here's a direct screenshot of what was available:
    http://wiki.bpmwiki.com/download/attachments/24052726/Capture24.JPG

    glad to help & good luck. tony

    ReplyDelete