public Document GetCollection() { ///////////////////////////////////////////////////// // Get all People from repository ///////////////////////////////////////////////////// var people = BloggingRepository.GetPeople(); ///////////////////////////////////////////////////// // Build JSON API document ///////////////////////////////////////////////////// var currentRequestUri = this.Request.GetUri(); using (var documentContext = new BloggingDocumentContext(currentRequestUri)) { var document = documentContext .NewDocument(currentRequestUri) .SetJsonApiVersion(JsonApiVersion.Version10) .Links() .AddUpLink() .AddSelfLink() .LinksEnd() .ResourceCollection(people) .Relationships() .AddRelationship("articles", new[] { Keywords.Related }) .AddRelationship("comments", new[] { Keywords.Related }) .RelationshipsEnd() .Links() .AddSelfLink() .LinksEnd() .ResourceCollectionEnd() .WriteDocument(); return(document); } }