Skip to content
This repository has been archived by the owner on Aug 16, 2019. It is now read-only.

AppInventor Api Spec

Evana13G edited this page Jul 11, 2012 · 1 revision

I am going to write an API that talks between the iSENSE API (api.php) and the AppInventor dev environment (Block editor) to create communication between Apps created in AppInventor and the website.

AppInventor will build URL requests to api.php. The response content sent back from api.php is formatted as a JSON object. This is problematic because AppInventor only supports the functionality behind list data structures. This is where the AppInventor api is necessary. The AppInventor api will take all response content sent back from api.php and throw it into a list data structure and send it back to AppInventor in that format. I also plan on having the AppInventor api communicate post information to api.php before the request is made. That is, build the requests in the api upon receiving data from AppInventor. It will also do data checking, and check to see that all necessary parameters are set for the posts.

Here is the plan: send back data in the form [[status, field1, field2][[statusdata], [data1], [data2]]] OR status[statusdata,[field1[data1]],[field2[data2]]]

At the moment the api will have a switch/case situation that depends on the "method" variable posted by appinventor. Each case will check for the necessary parameters and if all necessary parameters are supplied, it will call a specific "app_method" function. Yes there will be an "app_method" function for each method, because the parameter requirements for post methods are not universal. (One way we could condense this is by grouping functions by "necessary parameters" and call the appropriate getResult function)... within this function the post is made to api.php and the return value is the JSON object. Back to the case function, the processing will be done. I could probably also just make one "JSONtoList" function.

Clone this wiki locally