Accessing existing database built through Rails Application

53 views
Skip to first unread message

Robert Martin

unread,
Oct 28, 2013, 3:37:47 PM10/28/13
to app-...@googlegroups.com
Hi,

I have built a rails app and now want to have a mobile app version of it. The mobile application will only need to read existing data that has been generated via the rails application online. For example, if I add a promotion through my online ui, it only needs to be viewable by the end user on the mobile app, who can opt to purchase the promotion.

Subsequently they can access their account to view promotions bought etc.

Is it possible to drag the data from my existing postgresql database? I watched a tutorial via appigee that said you have to create a database for the mobile app as well. This is not ideal as no creation of records will be required via the mobile app.

Please could you advise.

Many thanks,

Robert

Michael Malloy

unread,
Oct 28, 2013, 3:53:20 PM10/28/13
to app-...@googlegroups.com
Hi Robert,

Your mobile app should still be able to use your legacy Postgres data.  Depending on your platform, there are database drivers available.  Apigee App Services can coexist with Postgres.  However, you will not be able to do queries that span both databases.  What data do you plan to store in Apigee App Services?

Robert Martin

unread,
Oct 28, 2013, 4:18:16 PM10/28/13
to app-...@googlegroups.com
Hi Michael,

At present my app allows clients to create promotions that are available for end users to purchase. The mobile app is for the end user only. I would need for end users to be able to purchase these promotions and for the existing database to record this as purchased within their account. Then, when they are ready to redeem the promotion, this will then tell the database that this has been used. I don't really need the end user to have the ability to create anything from the mobile apps, other than purchases or redemptions, as all creation of promotions, accounts etc will be handled by a web UI.

Thanks,

Robert


--
You received this message because you are subscribed to a topic in the Google Groups "App Craft" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/app-craft/Dbp1zhnvL9Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to app-craft+...@googlegroups.com.
To post to this group, send email to app-...@googlegroups.com.
Visit this group at http://groups.google.com/group/app-craft.

Robert Martin

unread,
Oct 28, 2013, 4:21:06 PM10/28/13
to app-...@googlegroups.com
My understanding is that I could use a REST API to achieve this but need guidance on what would be the best approach.

Tim Anglade

unread,
Oct 28, 2013, 4:33:45 PM10/28/13
to app-...@googlegroups.com
Hi Robert, building a REST API may be the right approach if your data is already stored behind Rails and you have the kinks in your data model worked out. Once the API is exposed, you can use patterns similar to the ones shown in the class to do some AJAX calls and mark the orders as placed/redeemed/etc. The following resources may be useful to learn how to build a REST API in your Rails app: 

As Michael alluded to, the other option would be for you to port your data to App Services instead. But that means you’d have to recode your UI and some of your business logic as well. If you’re interested in that option nonetheless, you would have to
1) export your tables in (maybe in CSV), 
2) convert them to JSON (maybe with a tool like https://github.com/darwin/csv2json) — you may need to recombine the data there too, if your App Services data model does not match your relational data model.
3) import them in App Services (by just doing a POST of the JSON representation of each table to each collection endpoint).


You received this message because you are subscribed to the Google Groups "App Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-craft+...@googlegroups.com.

Robert Martin

unread,
Oct 28, 2013, 5:09:40 PM10/28/13
to app-...@googlegroups.com
Hi Tim,

Many thanks for the wealth of information provided! It would make sense to utilize what I have in place already as I also use AWS S3 for image storage, and it would be beneficial to be able to drag the data directly from their respective repositories rather than rebuild something new. I didn't realize it would involve so much but there you go!

Thanks,

Robert
Reply all
Reply to author
Forward
0 new messages