Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Perl, Android web app, AJAX, JSON

by monx663 (Sexton)
on Nov 20, 2017 at 22:49 UTC ( [id://1203850]=perlquestion: print w/replies, xml ) Need Help??

monx663 has asked for the wisdom of the Perl Monks concerning the following question:

Hi all

This is not a 100% Perl question but I am Perl programmer and my question touches on Perl heavily. There is a fully functional web based CMS that is written in Perl for which I would like to make certain functionality available to an Android app being written. The requirements are not that "heavy".

The Android App needs to do the following few things:

* Send a username/password combination to gain access to the CMS backoffice.

* Call certain URLs which will enable the app to get a list of objects (images,names, other table contents) available in the CMS's database.

* Probably POST to certain URLs in order to be able to upload images and create content.

My question is: What methodology/APIs should I be looking at to complete this Perl CMS/Android app "integration". I was thinking of writing an AJAX layer that would expose certain methods to the Android app, which will be calling them via HTTP requests. I was also thinking of modifying certain of the CMS's packages to perhaps implement methods for JSON based communication of textual and binary data (images). I have also heard of Mojolistic, which supposedly is intended for writing RESTful APIs but find this a bit of an overkill for my scenario.

Does anybody want to offer any of his thoughts about which route to pursue?

Replies are listed 'Best First'.
Re: Perl, Android web app, AJAX, JSON
by LanX (Saint) on Nov 20, 2017 at 23:30 UTC
    I've never done it but my approach would be to build the App using HTML5

    See this how-to-create-an-android-app-using-html-5 discussion on stack overflow.

    Concerning the API to your CMS, all your ideas sound good.

    It's hard to tell without deep knowledge of the extendibility of your CMS.

    HTH! :)

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

      Hi Rolf and thanks for your input. The mobile app is being built in HTML5 but the various drop-down boxes need to be populated with data from the CMS.

      Regarding the extendibility of the CMS it can be thought of as "infinite". :p

      The CMS was written by myself and weights more than 1Mb of object oriented Perl code, with certain modules already exposing web methods that accept POSTs/GETs, provided that the POST/GET request is accompanied by the authentication session cookie.

      My question was, shall I write the API using AJAX or only stick with JSON for the data interchange?

      Cheers,

      Konstantinos

        > My question was, shall I write the API using AJAX or only stick with JSON for the data interchange?

        This is not an XOR question, a XMLHttpRequest can perfectly interact with REST and process JSON and/or XML.

        What do you mean with AJAX ? ? ?

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Wikisyntax for the Monastery

A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1203850]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-12-07 21:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which IDE have you been most impressed by?













    Results (50 votes). Check out past polls.