Reputation: 1
I am trying to write a simple ruby script to collect an array of JSON objects from a RESTful web service. I have read a lot of documentation that suggests I need to create an HTTP GET request, but I haven't seen an example of how to pass parameters to only return the objects I need. (I.e. I need to retrieve ONLY JSON objects with a particular name/value pair)
Essentially I am trying to query a database that can return information in JSON format, but I only want to select objects that meet certain criteria, and store that in an array.
I have been able to retrieve ONE JSON object, by looking at the NET requests in chrome developer tools when I manually search for one of these objects using a web GUI, but I cannot figure out how to generate a request for multiple objects.
Sorry if this is a dumb question, I am new to both ruby and REST.
Thanks!
Upvotes: 0
Views: 729
Reputation: 3214
I would recommend viewing the presentations about REST API first and find some talks on Youtube:
Most useful gems at current moment:
And don't forget Grape
.
If you want to go deeper in the area, next books will help you with that:
Upvotes: 1
Reputation: 1
Using java/jpa with REST, we use a named query or a native query. I would be surprised if Ruby did not have something similar.
Upvotes: 0