I’m somewhat new to Android
, JSON
, and Rails
so please forgive my ignorance or if I’m too vague. I’ve built a basic Android app that builds a JSON
object with red, green, and blue values. I’ve also built a Ruby
site with a Model
for “Settings” that creates a new entry with red, green, and blue value. I can create the new entries using “mysite.com/settings/new”, entering my values, and then hitting “Create” (I’m using pretty much the default rails stuff and used rails generate scaffold). The problem I’m having is building the “bridge” between the two technologies. What path do I send this data to? I’ve read this post: How to send POST request in JSON using HTTPClient? as reference but I’m unsure what “path” to pass to the HttpPost. Any help is greatly appreciated!
Asked
Active
Viewed 494 times
0
2 Answers
0
The path is mysite.com/settings
.
This path will map to SettingsController#create
if you send a POST request to it, and will map to SettingsController#index
if sending a GET request.
You can run $rake routes
in command line within your Rails app. Then you'll see list of all routes.
Make sure your request is POST and content-type is JSON as the other question you mentioned.

Billy Chan
- 24,625
- 4
- 52
- 68
0
What i would for for a project like this is create a API take a look at http://railscasts.com/episodes/348-the-rails-api-gem
then you can tell your Android app to get the data from there.

MZaragoza
- 10,108
- 9
- 71
- 116