0

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!

Community
  • 1
  • 1
pnus
  • 187
  • 12

2 Answers2

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
  • 23,554
  • 4
  • 48
  • 66
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
  • 9,447
  • 9
  • 60
  • 96