| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="utf-8"> |
| <meta name="viewport" content="width=device-width,initial-scale=1"> |
| <title>Apache Isis v2 Profile (Simplified Representation) :: Apache Isis</title> |
| <link rel="canonical" href="https://isis.apache.org/vro/2.0.0-M5/content-negotiation/apache-isis-v2-profile.html"> |
| <meta name="generator" content="Antora 2.3.4"> |
| <link rel="stylesheet" href="../../../_/css/site.css"> |
| <link rel="stylesheet" href="../../../_/css/site-custom.css"> |
| <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,700,700i|Raleway:300,400,500,700,800|Montserrat:300,400,700" rel="stylesheet"> |
| <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css"/> |
| <link rel="home" href="https://isis.apache.org" title="Apache Isis"> |
| <link rel="next" href="other-representations.html" title="Other Representations"> |
| <link rel="prev" href="../content-negotiation.html" title="Content Negotiation"> |
| </head> |
| <body class="article"> |
| <header class="header"> |
| <nav class="navbar"> |
| <div class="navbar-brand"> |
| <a class="navbar-item" href="https://isis.apache.org"> |
| <span class="icon"> |
| <img src="../../../_/img/isis-logo-48x48.png"></img> |
| </span> |
| <span>Apache Isis</span> |
| </a> |
| <button class="navbar-burger" data-target="topbar-nav"> |
| <span></span> |
| <span></span> |
| <span></span> |
| </button> |
| </div> |
| <div id="topbar-nav" class="navbar-menu"> |
| <a class="navbar-end"> |
| <div class="navbar-item hide-for-print"> |
| <span> |
| <input id="algolia-search-input" placeholder="Search"></span> |
| </span> |
| </div> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">Quick Start</a> |
| <div class="navbar-dropdown"> |
| <span class="navbar-item navbar-heading">Starter Apps</span> |
| <a class="navbar-item" href="../../../docs/2.0.0-M5/starters/helloworld.html">Hello World</a> |
| <a class="navbar-item" href="../../../docs/2.0.0-M5/starters/simpleapp.html">Simple App</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Demos & Tutorials</span> |
| <a class="navbar-item" href="../../../docs/2.0.0-M5/demo/about.html">Demo App</a> |
| <a class="navbar-item" href="https://danhaywood.gitlab.io/isis-petclinic-tutorial-docs/petclinic/1.16.2/intro.html">Petclinic (tutorial)</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Resources</span> |
| <a class="navbar-item" href="../../../docs/2.0.0-M5/resources/cheatsheet.html">Cheatsheet</a> |
| <a class="navbar-item" href="../../../docs/2.0.0-M5/resources/icons.html">Icons</a> |
| </div> |
| </div> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">Guides</a> |
| <div class="navbar-dropdown"> |
| <span class="navbar-item navbar-heading">Development</span> |
| <a class="navbar-item" href="../../../setupguide/2.0.0-M5/about.html">Setup Guide</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Core</span> |
| <a class="navbar-item" href="../../../userguide/2.0.0-M5/about.html">User Guide</a> |
| <a class="navbar-item" href="../../../refguide/2.0.0-M5/about.html">Reference Guide</a> |
| <a class="navbar-item" href="../../../testing/2.0.0-M5/about.html">Testing Guide</a> |
| </div> |
| </div> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">Libraries</a> |
| <div class="navbar-dropdown"> |
| <span class="navbar-item navbar-heading">For Use in Apps</span> |
| <a class="navbar-item" href="../../../subdomains/2.0.0-M5/about.html">Subdomain Libraries</a> |
| <a class="navbar-item" href="../../../valuetypes/2.0.0-M5/about.html">Value Types</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Integrate between Apps</span> |
| <a class="navbar-item" href="../../../mappings/2.0.0-M5/about.html">Bounded Context Mapping Libraries</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Other</span> |
| <a class="navbar-item" href="../../../incubator/2.0.0-M5/about.html">Incubator</a> |
| <a class="navbar-item" href="../../../legacy/2.0.0-M5/about.html">Legacy</a> |
| </div> |
| </div> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">Components</a> |
| <div class="navbar-dropdown"> |
| <span class="navbar-item navbar-heading">Viewers</span> |
| <a class="navbar-item" href="../../../vw/2.0.0-M5/about.html">Web UI (Wicket)</a> |
| <a class="navbar-item" href="../../../vro/2.0.0-M5/about.html">REST API (Restful Objects)</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Security</span> |
| <a class="navbar-item" href="../../../security/2.0.0-M5/about.html">Security Guide</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Persistence</span> |
| <a class="navbar-item" href="../../../pjpa/2.0.0-M5/about.html">JPA (EclipseLink)</a> |
| <a class="navbar-item" href="../../../pjdo/2.0.0-M5/about.html">JDO (DataNucleus)</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Extensions</span> |
| <a class="navbar-item" href="../../../extensions/2.0.0-M5/about.html">Extensions Catalog</a> |
| </div> |
| </div> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">Support</a> |
| <div class="navbar-dropdown"> |
| <span class="navbar-item navbar-heading">Contact</span> |
| <a class="navbar-item" href="../../../docs/2.0.0-M5/support/slack-channel.html">Slack</a> |
| <a class="navbar-item" href="../../../docs/2.0.0-M5/support/mailing-list.html">Mailing Lists</a> |
| <a class="navbar-item" href="https://issues.apache.org/jira/browse/ISIS">JIRA</a> |
| <a class="navbar-item" href="https://stackoverflow.com/questions/tagged/isis">Stack Overflow</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Releases</span> |
| <a class="navbar-item" href="../../../docs/2.0.0-M5/downloads/how-to.html">Downloads</a> |
| <a class="navbar-item" href="../../../relnotes/2.0.0-M5/about.html">Release Notes</a> |
| <a class="navbar-item" href="../../../docs/2.0.0-M5/archive/1-x.html">Archive (1.x)</a> |
| <hr class="navbar-divider"/> |
| <span class="navbar-item navbar-heading">Framework</span> |
| <a class="navbar-item" href="../../../conguide/2.0.0-M5/about.html">Contributors' Guide</a> |
| <a class="navbar-item" href="../../../comguide/2.0.0-M5/about.html">Committers' Guide</a> |
| <a class="navbar-item" href="../../../core/2.0.0-M5/about.html">Core Design</a> |
| </div> |
| </div> |
| <div class="navbar-item has-dropdown is-hoverable"> |
| <a class="navbar-link" href="#">ASF</a> |
| <div class="navbar-dropdown"> |
| <a class="navbar-item" href="http://www.apache.org/">Apache Homepage</a> |
| <a class="navbar-item" href="https://www.apache.org/events/current-event">Events</a> |
| <a class="navbar-item" href="https://www.apache.org/licenses/">Licenses</a> |
| <a class="navbar-item" href="https://www.apache.org/security/">Security</a> |
| <a class="navbar-item" href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a> |
| <a class="navbar-item" href="https://www.apache.org/foundation/thanks.html">Thanks</a> |
| <hr class="navbar-divider"/> |
| <a class="navbar-item" href="https://whimsy.apache.org/board/minutes/Isis.html">PMC board minutes</a> |
| </div> |
| </div> |
| <a class="navbar-item" href="../../../docs/2.0.0-M5/about.html"> |
| <span class="icon"> |
| <img src="../../../_/img/home.png"></img> |
| </span> |
| </a> |
| </div> |
| </div> |
| </nav> |
| </header> |
| <div class="body "> |
| <div class="nav-container" data-component="vro" data-version="2.0.0-M5"> |
| <aside class="nav"> |
| <div class="panels"> |
| <div class="nav-panel-pagination"> |
| <a class="page-previous" rel="prev" href="../content-negotiation.html" title="Content Negotiation"><span></span></a> |
| <a class="page-next" rel="next" |
| href="other-representations.html" title="Other Representations"><span></span></a> |
| <!-- |
| page.parent doesn't seem to be set... |
| <a class="page-parent" rel="prev" href="../content-negotiation.html" title="Content Negotiation"><span></span></a> |
| --> |
| </div> |
| <div class="nav-panel-menu is-active" data-panel="menu"> |
| <nav class="nav-menu"> |
| <h3 class="title"><a href="../about.html">REST API (Restful Objects Viewer)</a></h3> |
| <ul class="nav-list"> |
| <li class="nav-item" data-depth="0"> |
| <ul class="nav-list"> |
| <li class="nav-item" data-depth="1"> |
| <a class="nav-link" href="../setup-and-configuration.html">Setup and Configuration</a> |
| </li> |
| <li class="nav-item" data-depth="1"> |
| <a class="nav-link" href="../ro-spec.html">RO Spec</a> |
| </li> |
| <li class="nav-item" data-depth="1"> |
| <button class="nav-item-toggle"></button> |
| <a class="nav-link" href="../content-negotiation.html">Content Negotiation</a> |
| <ul class="nav-list"> |
| <li class="nav-item is-current-page" data-depth="2"> |
| <a class="nav-link" href="apache-isis-v2-profile.html">Apache Isis v2 Profile</a> |
| </li> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="other-representations.html">Other Representations</a> |
| </li> |
| </ul> |
| </li> |
| <li class="nav-item" data-depth="1"> |
| <a class="nav-link" href="../security.html">Security</a> |
| </li> |
| <li class="nav-item" data-depth="1"> |
| <a class="nav-link" href="../layout-resources.html">Layout Resources</a> |
| </li> |
| <li class="nav-item" data-depth="1"> |
| <a class="nav-link" href="../hints-and-tips.html">Hints-n-Tips</a> |
| </li> |
| <li class="nav-item" data-depth="1"> |
| <button class="nav-item-toggle"></button> |
| <span class="nav-text">Extensions</span> |
| <ul class="nav-list"> |
| <li class="nav-item" data-depth="2"> |
| <a class="nav-link" href="../cors/about.html">CORS</a> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </nav> |
| </div> |
| <div class="nav-panel-explore" data-panel="explore"> |
| <div class="context"> |
| <span class="title">REST API (Restful Objects Viewer)</span> |
| <span class="version">2.0.0-M5</span> |
| </div> |
| <ul class="components"> |
| <li class="component"> |
| <span class="title"> </span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../docs/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">BC Mapping Libraries</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../mappings/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Committers' Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../comguide/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Contributors' Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../conguide/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Design Docs</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../core/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Extensions Catalog</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../extensions/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Incubator Catalog</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../incubator/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">JDO/DataNucleus</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../pjdo/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">JPA</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../pjpa/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Legacy Catalog</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../legacy/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Reference Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../refguide/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Release Notes</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../relnotes/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component is-current"> |
| <span class="title">REST API (Restful Objects Viewer)</span> |
| <ul class="versions"> |
| <li class="version is-current is-latest"> |
| <a href="../about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Security Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../security/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Setup Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../setupguide/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Subdomains Catalog</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../subdomains/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Testing Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../testing/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Tooling</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../tooling/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">User Guide</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../userguide/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Value Types Catalog</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../valuetypes/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| <li class="component"> |
| <span class="title">Web UI (Wicket Viewer)</span> |
| <ul class="versions"> |
| <li class="version is-latest"> |
| <a href="../../../vw/2.0.0-M5/about.html">2.0.0-M5</a> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </aside> |
| </div> |
| <main role="main"> |
| <div class="toolbar" role="navigation"> |
| <button class="nav-toggle"></button> |
| <a href="../../../docs/2.0.0-M5/about.html" class="home-link"></a> |
| <nav class="breadcrumbs" aria-label="breadcrumbs"> |
| <ul> |
| <li><a href="../about.html">REST API (Restful Objects Viewer)</a></li> |
| <li><a href="../content-negotiation.html">Content Negotiation</a></li> |
| <li><a href="apache-isis-v2-profile.html">Apache Isis v2 Profile</a></li> |
| </ul> |
| </nav> |
| <div class="edit-this-page"><a href="https://github.com/apache/isis/edit/2.0.0-M5/viewers/restfulobjects/adoc/modules/ROOT/pages/content-negotiation/apache-isis-v2-profile.adoc">Edit</a></div> |
| </div> |
| <article class="doc"> |
| <a name="section-top"></a> |
| <h1 class="page">Apache Isis v2 Profile (Simplified Representation)</h1> |
| <div id="preamble"> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>The representations defined by the RO spec are very rich and enable complex client-side applications to be built. |
| However, their sophistication can be an impediment to their use if one wishes to write a simple app using third-party components that expect to consume much simpler representations.</p> |
| </div> |
| <div class="paragraph"> |
| <p>Apache Isis also provides support for its own simplified representation for the most commonly-used representations. |
| This is implemented using the <a href="../../../refguide/2.0.0-M5/viewer/index/restfulobjects/rendering/service/conneg/ContentNegotiationService.html" class="page">ContentNegotiationService</a> described in the |
| <a href="../content-negotiation.html" class="page">architecture</a> chapter.</p> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="accept-header"><a class="anchor" href="#accept-header"></a>Accept Header</h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>The RO spec uses the standard <code>Accept</code> header for content negotiation, and defines its own "profile" for the standard representations; these take the form:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>Accept: application/json;profile="urn:org.restfulobjects:repr-types/xxx"</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>where "xxx" varies by resource. |
| The detail can be found in <a href="https://www.restfulobjects.org/spec/1.0/section-a/chapter-02.html#_2-4-1-representationtype-profile-parameter">section 2.4.1</a> of the RO spec.</p> |
| </div> |
| <div class="paragraph"> |
| <p>The "Isis" profile allows the client to request simplified representations for the most frequently accessed resources. |
| This is done by specifying an <code>Accept</code> header of:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>Accept: application/json;profile="urn:org.apache.isis/v2"</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>Not every resource supports this header, but the most commonly accessed ones do. |
| In each case the server will set the |
| <code>Content-Type</code> header so that the client knows how to process the representation.</p> |
| </div> |
| <div class="paragraph"> |
| <p>The <a href="https://www.youtube.com/watch?v=HMSqapQDY_4">screencast</a> demonstrates the feature.</p> |
| </div> |
| <div class="paragraph"> |
| <p>The sections below explain in a little more detail what is returned when this profile is activated.</p> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="domain-object"><a class="anchor" href="#domain-object"></a>Domain Object</h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>If a domain object resource (<a href="https://www.restfulobjects.org/spec/1.0/section-c/chapter-14.html">section 14</a>) is accessed with the Apache Isis profile, the resultant representation is a JSON object with simple key/value pairs for each property.</p> |
| </div> |
| <div class="paragraph"> |
| <p>The contents of any collections are also eagerly returned, consisting of an array of elements of each referenced object. |
| Each such element contains key/value pairs of each property (in other words, a grid of data is returned). |
| Each element also has a special <code>$$href</code> property (so that the client can easily navigate to a resource for that object) and a <code>$$title</code> property (to use as a label, eg the hyperlink text).</p> |
| </div> |
| <div class="paragraph"> |
| <p>In addition, the representation defined by the RO spec is also included, under a special <code>$$ro</code> property.</p> |
| </div> |
| <div class="paragraph"> |
| <p>For example, in a todo app, accessing this resource:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>http://localhost:8080/restful/objects/TODO/45</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>with an <code>Accept</code> request header of:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>Accept: application/json;profile="urn:org.apache.isis/v2"</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>returns the following representation:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>{ |
| "$$href" : "http://localhost:8080/restful/objects/TODO/45", <i class="conum" data-value="1"></i><b>(1)</b> |
| "$$instanceId" : "45", <i class="conum" data-value="2"></i><b>(2)</b> |
| "$$title" : "Buy bread due by 2015-12-04", <i class="conum" data-value="3"></i><b>(3)</b> |
| "description" : "Buy bread", <i class="conum" data-value="4"></i><b>(4)</b> |
| "category" : "Domestic", |
| "subcategory" : "Shopping", |
| "complete" : false, |
| "atPath" : "/users/sven", |
| ... |
| "similarTo" : [ { <i class="conum" data-value="5"></i><b>(5)</b> |
| "$$href" : "http://localhost:8080/restful/objects/TODO/46", |
| "$$instanceId" : "46", |
| "$$title" : "Buy milk due by 2015-12-04", |
| "description" : "Buy milk", |
| "category" : "Domestic", |
| ... |
| }, { |
| "$$href" : "http://localhost:8080/restful/objects/TODO/47", |
| "$$instanceId" : "47", |
| "$$title" : "Buy stamps due by 2015-12-04", |
| "description" : "Buy stamps", |
| "category" : "Domestic", |
| ... |
| }, |
| ... |
| } ], |
| "dependencies" : [ ], |
| "$$ro" : { <i class="conum" data-value="6"></i><b>(6)</b> |
| "links" : [ ... ], |
| "extensions" : { /* ... */ }, |
| "title" : "Buy bread due by 2015-12-04", |
| "domainType" : "TODO", |
| "instanceId" : "45", |
| "members" : { /* ... */ } |
| } |
| }</code></pre> |
| </div> |
| </div> |
| <div class="colist arabic"> |
| <table> |
| <tr> |
| <td><i class="conum" data-value="1"></i><b>1</b></td> |
| <td>hyperlink to the representation</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="2"></i><b>2</b></td> |
| <td>instance id of the domain object (unique within its type)</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="3"></i><b>3</b></td> |
| <td>title of the domain object</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="4"></i><b>4</b></td> |
| <td>all the properties of the domain object (to which the caller has access), as key/value pairs</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="5"></i><b>5</b></td> |
| <td>contents of each collection</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="6"></i><b>6</b></td> |
| <td>special <code>$$ro</code> json-prop, being the normal RO Spec representation for this object</td> |
| </tr> |
| </table> |
| </div> |
| <div class="paragraph"> |
| <p>with a <code>Content-Type</code> header:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>Content-Type: application/json; |
| profile="urn:org.apache.isis/v2";repr-type="object"</code></pre> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="object-collection"><a class="anchor" href="#object-collection"></a>Domain Object Collection</h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>If a domain object collection (<a href="https://www.restfulobjects.org/spec/1.0/section-c/chapter-17.html">section 17</a>) is accessed with this profile, then the resultant representation is as an array of elements of key/value for each referenced object, and again each element the containing the key/value pairs of the properties of that object (a grid, again).</p> |
| </div> |
| <div class="paragraph"> |
| <p>In addition, the representation defined by the RO spec is also included, as a special object with a single <code>$$ro</code> |
| property.</p> |
| </div> |
| <div class="paragraph"> |
| <p>For example, in a todo app, accessing this resource:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>http://localhost:8080/restful/objects/TODO/45/collections/similarTo</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>with an <code>Accept</code> request header of:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>Accept: application/json;profile="urn:org.apache.isis/v2"</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>returns the following representation:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>[ <i class="conum" data-value="1"></i><b>(1)</b> |
| { |
| "$$href" : "http://localhost:8080/restful/objects/TODO/46", <i class="conum" data-value="2"></i><b>(2)</b> |
| "$$instanceId" : "46", <i class="conum" data-value="3"></i><b>(3)</b> |
| "$$title" : "Buy milk due by 2015-12-04", <i class="conum" data-value="4"></i><b>(4)</b> |
| "description" : "Buy milk", <i class="conum" data-value="5"></i><b>(5)</b> |
| "category" : "Domestic", |
| ... |
| }, { |
| "$$href" : "http://localhost:8080/restful/objects/TODO/47", |
| "$$title" : "Buy stamps due by 2015-12-04", |
| "description" : "Buy stamps", |
| "category" : "Domestic", |
| ... |
| }, { |
| "$$href" : "http://localhost:8080/restful/objects/TODO/48", |
| "$$title" : "Mow lawn due by 2015-12-10", |
| "description" : "Mow lawn", |
| "category" : "Domestic", |
| ... |
| }, |
| ... |
| , { |
| "$$ro" : { <i class="conum" data-value="6"></i><b>(6)</b> |
| "id" : "similarTo", |
| "memberType" : "collection", |
| "links" : [ ... ], |
| "extensions" : { /* ... */ }, |
| "value" : [ ... ] |
| } |
| } |
| ]</code></pre> |
| </div> |
| </div> |
| <div class="colist arabic"> |
| <table> |
| <tr> |
| <td><i class="conum" data-value="1"></i><b>1</b></td> |
| <td>returns a JSON array, not a JSON object</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="2"></i><b>2</b></td> |
| <td>hyperlink to the representation</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="3"></i><b>3</b></td> |
| <td>instance id of the domain object (unique within its type)</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="4"></i><b>4</b></td> |
| <td>title of the domain object</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="5"></i><b>5</b></td> |
| <td>all the properties of the domain object (to which the caller has access), as key/value pairs</td> |
| </tr> |
| <tr> |
| <td><i class="conum" data-value="6"></i><b>6</b></td> |
| <td>last element is a special object with a single <code>$$ro</code> json-prop, being the normal RO Spec representation for this object</td> |
| </tr> |
| </table> |
| </div> |
| <div class="paragraph"> |
| <p>with a <code>Content-Type</code> header:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>Content-Type: application/json;profile="urn:org.apache.isis/v2";repr-type="object-collection"</code></pre> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="action-invocation"><a class="anchor" href="#action-invocation"></a>Action Invocation</h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>When an action is invoked (<a href="https://www.restfulobjects.org/spec/1.0/section-c/chapter-19.html">section 19</a>) it can return a domain object, a list, a scalar, or return nothing.</p> |
| </div> |
| <div class="sect2"> |
| <h3 id="returning-an-object"><a class="anchor" href="#returning-an-object"></a>Returning an Object</h3> |
| <div class="paragraph"> |
| <p>If the action returned an object, then the <a href="#vro:ROOT:simplified-representations.adoc#domain-object" class="page unresolved">domain object representation</a> is returned.</p> |
| </div> |
| <div class="paragraph"> |
| <p>For example, in a todo app, accessing this resource:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>http://localhost:8080/restful/objects/TODO/45/actions/updateCost/invoke</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>with an <code>Accept</code> request header of:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>Accept: application/json;profile="urn:org.apache.isis/v2"</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>returns the following representation:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>{ |
| "$$href" : "http://localhost:8080/restful/objects/TODO/45", |
| "$$instanceId" : "45", |
| "$$title" : "Buy bread due by 2015-12-04", |
| "description" : "Buy bread", |
| "category" : "Domestic", |
| "subcategory" : "Shopping", |
| "complete" : false, |
| ... |
| "similarTo" : [ ... ] |
| ... |
| "$$ro" : { /* ... */ } |
| }</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>with a <code>Content-Type</code> of:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>Content-Type: application/json;profile="urn:org.apache.isis/v2";repr-type="object"</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>... in other words no different to a representation obtained of the returned domain object directly.</p> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="returning-a-list"><a class="anchor" href="#returning-a-list"></a>Returning a List</h3> |
| <div class="paragraph"> |
| <p>On the other hand if the action returned a list (a "standalone" collection, then an array representation is returned. |
| This is very similar to that returned by a <a href="#vro:ROOT:simplified-representations.adoc#object-collection" class="page unresolved">(parented) object collection</a>, though with a slightly different <code>Content-Type</code> to distinguish.</p> |
| </div> |
| <div class="paragraph"> |
| <p>For example, in a todo app, accessing this resource:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>http://localhost:8080/restful/services/ToDoItems/actions/notYetComplete/invoke</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>with an <code>Accept</code> request header of:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>Accept: application/json;profile="urn:org.apache.isis/v2"</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>returns the following representation:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>[ { |
| "$$href" : "http://localhost:8080/restful/objects/TODO/45", |
| "$$instanceId" : "45", |
| "$$title" : "Buy bread due by 2015-12-04", |
| "description" : "Buy bread", |
| "category" : "Domestic", |
| ... |
| }, { |
| "$$href" : "http://localhost:8080/restful/objects/TODO/46", |
| "$$instanceId" : "46", |
| "$$title" : "Buy milk due by 2015-12-04", |
| "description" : "Buy milk", |
| "category" : "Domestic", |
| ... |
| }, |
| ... |
| , { |
| "$$ro" : { |
| "links" : [ ... ] |
| "resulttype" : "list", |
| "result" : { /* ... */ } |
| "value" : [ ... ], |
| "links" : [ ... ], |
| "extensions" : { } |
| } |
| } |
| } ]</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>with a <code>Content-Type</code> header:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlightjs highlight"><code>Content-Type: application/json;profile="urn:org.apache.isis/v2";repr-type="list"</code></pre> |
| </div> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="returning-scalarnothing"><a class="anchor" href="#returning-scalarnothing"></a>Returning Scalar/Nothing</h3> |
| <div class="paragraph"> |
| <p>Note that actions returning scalar values or nothing (which includes <code>void</code> actions) are not supported; for these the |
| regular RO spec representation will be returned.</p> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="configuration-properties"><a class="anchor" href="#configuration-properties"></a>Global Config Props (Deprecated)</h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>If all that is required is a very simple representations (of objects), you can configure the Restful Objects viewer |
| to provide a simplified output, then this can be done with a number of (global) configuration properties.</p> |
| </div> |
| <div class="paragraph"> |
| <p>These configuration properties pre-date the support for the Apache Isis profile, and |
| are limited by the fact that they are global configuration settings, so cannot be influenced on a request-by-request |
| basis (as is the case with the <code>Accept</code> header used for the Apache Isis profile). They have therefore been |
| deprecated, and may be removed in the future.</p> |
| </div> |
| <div class="paragraph"> |
| <p>Details can be found in <a href="../setup-and-configuration.html#deprecated" class="page">here</a>.</p> |
| </div> |
| </div> |
| </div> |
| </article> |
| <aside class="article-aside toc hide-for-print" role="navigation"> |
| <p class="toc-title">On this page</p> |
| <div id="article-toc"></div> |
| </aside> |
| </main> |
| </div> |
| <footer class="footer"> |
| <div class="content"> |
| <div class="copyright"> |
| <p> |
| Copyright © 2010~2021 The Apache Software Foundation, licensed under the Apache License, v2.0. |
| <br/> |
| Apache, the Apache feather logo, Apache Isis, and the Apache Isis project logo are all trademarks of The Apache Software Foundation. |
| </p> |
| </div> |
| <div class="revision"> |
| <p>Revision: 2.0.0-M5.20210417-1912</p> |
| </div> |
| </div> |
| </footer> |
| <script src="../../../_/js/site.js"></script> |
| <script async src="../../../_/js/vendor/highlight.js"></script> |
| <script src="../../../_/js/vendor/jquery-3.4.1.min.js"></script> |
| <script src="../../../_/js/vendor/jquery-ui-1.12.1.custom.widget-only.min.js"></script> |
| <script src="../../../_/js/vendor/jquery.tocify.min.js"></script> |
| |
| <script> |
| $(function() { |
| $("#article-toc").tocify( { |
| showEffect: "slideDown", |
| hashGenerator: "pretty", |
| hideEffect: "slideUp", |
| selectors: "h2, h3", |
| scrollTo: 120, |
| smoothScroll: true, |
| theme: "jqueryui", |
| highlightOnScroll: true |
| } ); |
| }); |
| </script> |
| |
| <script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script> |
| <script> |
| function focusSearchInput () { document.querySelector('#algolia-search-input').focus() } |
| var search = docsearch({ |
| appId: '5ISP5TFAEN', |
| apiKey: '0fc51c28b4ad46e7318e96d4e97fab7c', |
| indexName: 'isis-apache-org', |
| inputSelector: '#algolia-search-input', |
| autocompleteOptions: { hint: false, keyboardShortcuts: ['s'] }, |
| debug: false, |
| }).autocomplete |
| search.on('autocomplete:closed', function () { search.autocomplete.setVal() }) |
| focusSearchInput() |
| window.addEventListener('load', focusSearchInput); |
| </script> |
| |
| <!-- |
| docsearch options: |
| https://docsearch.algolia.com/docs/behavior/ |
| --> |
| <!-- |
| https://www.algolia.com/doc/api-reference/api-parameters/ |
| algoliaOptions: { hitsPerPage: 6 }, |
| --> |
| </body> |
| </html> |