WP Rest API vs - how can I get author information from v2 - the author ID?

Viewed 17804

I'm building a front end using WP JSON, and I need (among other things) the name of the author of each post.

In V1, this was easy - here's a fragment of a typical post object from calling http://example.com/wp-json/posts/1:

 {
    "ID": 1,
    "title": "Hello world!",
    "status": "publish",
    "type": "post",
    "author": {
        "ID": 1,
        "name": "admin",
        "slug": "admin",
        "URL": "",
        "avatar": "http:\/\/0.gravatar.com\/avatar\/c57c8945079831fa3c19caef02e44614&d=404&r=G",
        "meta": {
            "links": {
                "self": "http:\/\/example.com\/wp-json\/users\/1",
                "archives": "http:\/\/example.com\/wp-json\/users\/1\/posts"
            }
        }
    },

But in V2, for author, all we get back is the ID (an integer). Passing this back to the API, we get a list of every article an author has written - but how can I get the author's information - their name, avatar, etc.?

PS: boy the V2 documentation is sparse...V1 was much better...

2 Answers
Related