umts / microservices-engine

Rails engine for attaching to our microservices and handling inter-service communication.
MIT License
0 stars 1 forks source link

Engine endpoint part 1 #3

Closed ennukee closed 8 years ago

ennukee commented 8 years ago

The engine will now mount an endpoint at /microservices_engine/v1/data (too long? eh) that can used to retrieve data from the main application.

Some info on usage (also in the file itself):

# Used to retrieve data from the local application
# Usage: http://(url)/data?models={MODELS}
#        MODELS: A set of model names to request data of separated
#                by commas.
# Example: http://larrysenior.com/data?models=ChewingGum,LarrysKid

Example response:

{ 
  "response": 200,
  "content": {
   "FieldTrip": 
    [{"id":1,"name":"apples","created_at":"2016-09-16T22:00:54.884Z","updated_at":"2016-09-16T22:00:54.884Z"},{"id":2,"name":"pears","created_at":"2016-09-16T22:00:59.225Z","updated_at":"2016-09-16T22:00:59.225Z"}],
   "TestModel": 
    [{"id":1,"name":"DansGame","meme":"200.0","created_at":"2016-09-16T22:01:11.416Z","updated_at":"2016-09-16T22:01:11.416Z"}]
  }
 }
ennukee commented 8 years ago

I wasn't even ready to push this but thanks for the feedback :D