Skip to content

Include Extras

Grant Winney edited this page Feb 16, 2018 · 1 revision

If you choose to add &include=author,tags to your query, the response includes detailed metadata about three things - the author, the primary tag, and all tags.

{
    "posts": [
        {
            "id": "5a808178464bf206394b96ad",
            "uuid": "d6d1f325-bcc8-4bf2-8364-0b89eea6bd4f",
            ...
            "author": {
                "id": "1",
                "name": "Grant Winney",
                "slug": "grant",
                "profile_image": "//www.gravatar.com/avatar/919003b5767665e865f7b9cb63fbbfd9?s=250&d=mm&r=x",
                "cover_image": null,
                "bio": "I write when I've got something to share - a personal project, a solution to a difficult problem, or just an idea. We learn by doing and sharing. We've all got something to contribute.",
                "website": "",
                "location": null,
                "facebook": "grantwinney",
                "twitter": "@grantwinney",
                "accessibility": "{\"nightShift\":false}",
                "locale": null,
                "visibility": "public",
                "meta_title": null,
                "meta_description": null,
                "tour": "[\"getting-started\",\"using-the-editor\",\"static-post\",\"featured-post\",\"upload-a-theme\"]"
            },
            "tags": [
                {
                    "id": "59e4dd1e9e02a10753defed6",
                    "name": "week in review",
                    "slug": "week-in-review",
                    "description": null,
                    "feature_image": null,
                    "visibility": "public",
                    "meta_title": null,
                    "meta_description": null,
                    "created_at": "2017-10-16T16:23:58.000Z",
                    "created_by": "1",
                    "updated_at": "2018-02-12T19:23:23.000Z",
                    "updated_by": "1",
                    "parent": null
                },
                {
                    "id": "5a696452b64b0f0df589ccc2",
                    "name": "api wrapper",
                    "slug": "api-wrapper",
                    "description": null,
                    "feature_image": null,
                    "visibility": "public",
                    "meta_title": null,
                    "meta_description": null,
                    "created_at": "2018-01-25T05:00:02.000Z",
                    "created_by": "1",
                    "updated_at": "2018-02-12T05:09:07.000Z",
                    "updated_by": "1",
                    "parent": null
                }
            ],
            "primary_tag": {
                "id": "59e4dd1e9e02a10753defed6",
                "name": "week in review",
                "slug": "week-in-review",
                "description": null,
                "feature_image": null,
                "visibility": "public",
                "meta_title": null,
                "meta_description": null,
                "created_at": "2017-10-16T16:23:58.000Z",
                "created_by": "1",
                "updated_at": "2018-02-12T19:23:23.000Z",
                "updated_by": "1",
                "parent": null
            }
        }
    ],
    "meta": {
        ...
    }
}

If you choose to omit it, including nothing extra, the "tags" array completely disappears, the "primary_tag" is null, but the "author" tag remains and becomes a string with the author id.

{
    "posts": [
        {
            "id": "5a808178464bf206394b96ad",
            ...
            "author": "1",
            "primary_tag": null,
        }
    ],
    "meta": {
        "pagination": {
            "page": 1,
            "limit": 1,
            "pages": 183,
            "total": 183,
            "next": 2,
            "prev": null
        }
    }
}
Clone this wiki locally