Do you have any preferences on good or bad responses from APIs? Or links to 
discussions on this subject.

I'm in the beginning stages of building v2 of an API with feedback from 
what we've learned doesn't work from v1, and want to pick up any other 
thoughts of what might turn out to be a mistake, or things you wish you had 
added or removed from your own APIs after you've built them.

Considerations:

* A common format for error messages
* Return multiple groups of results in the same response
* Return metadata about the result set along with the result (e.g. totals)

I'm currently leaning towards something like:

{
  "status":"ok",
  "latest_posts":{
    "total":42,
    "page":1,
    "per_page":10,
    "results":[
      {
        "type":"post",
        "id":123,
        "url":"http://www.example.com/posts/123";
        ...
      }
    ]
  },
  "popular_posts":{
    ...
  }
}

{
  "status":"error",
  "message":"..."
}


-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rails-oceania/-/tVcxIVy7Q_kJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.

Reply via email to