1"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[562],{8804:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>o,default:()=>l,frontMatter:()=>r,metadata:()=>c,toc:()=>a});var i=t(4246),s=t(1670);const r={id:"servicedescription",title:"Runtime Service Description"},o=void 0,c={id:"spec/servicedescription",title:"Runtime Service Description",description:"Client applications and tooling can use a runtime service description to understand how to interact with the service.",source:"@site/../docs/spec/rapid-pro-resource_description.md",sourceDirName:"spec",slug:"/spec/servicedescription",permalink:"/docs/spec/servicedescription",draft:!1,unlisted:!1,editUrl:"https://github.com/oasis-open/odata-rapid/edit/main/docs/../docs/spec/rapid-pro-resource_description.md",tags:[],version:"current",frontMatter:{id:"servicedescription",title:"Runtime Service Description"},sidebar:"docs",previous:{title:"Actions and Functions",permalink:"/docs/operations"},next:{title:"Batch Operations",permalink:"/docs/spec/batch"}},d={},a=[{value:"Types",id:"types",level:2},{value:"Properties",id:"properties",level:2},{value:"Meta Properties",id:"meta-properties",level:3},{value:"Types",id:"types-1",level:4},{value:"Collections",id:"collections",level:4},{value:"Dynamic Properties",id:"dynamic-properties",level:3},{value:"Service Entity Container",id:"service-entity-container",level:2}];function p(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",table:"table",th:"th",thead:"thead",tr:"tr",...(0,s.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.p,{children:["Client applications and tooling can use a runtime service description to understand how to interact with the service.\nBy convention, this description is retrieved by requesting the ",(0,i.jsx)(n.code,{children:"/$metadata"})," resource, located at the root of the service."]}),"\n",(0,i.jsx)(n.table,{children:(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Example"}),(0,i.jsxs)(n.th,{style:{textAlign:"left"},children:["GET ",(0,i.jsx)(n.a,{href:"https://jetsons.azurewebsites.net/$metadata?$format=application/json",children:(0,i.jsx)(n.code,{children:"https://jetsons.azurewebsites.net/$metadata"})}),(0,i.jsx)("br",{}),"Accept: application/json"]})]})})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Result:"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",children:'{\n "$Version": "4.01",\n "jetsons": {\n "company": {\n "$Kind": "EntityType",\n "$Key": ["stockSymbol"],\n "name": { "Type": "Edm.String" },\n "incorporated": { "$Type": "Edm.Date" },\n "stockSymbol": {},\n "employees": {\n "$Kind": "NavigationProperty",\n "$Collection": true,\n "$Type": "jetsons.employee",\n "$ContainsTarget": true\n }\n },\n "employee": {\n "$Kind": "EntityType",\n "$Key": ["id"],\n "id": { "$Type": "Edm.Int32" },\n "firstName": { "$Type": "Edm.String" },\n "lastName": { "$Type": "Edm.String" },\n "title": { "$Type": "Edm.String" }\n },\n "Service": {\n "$Kind": "EntityContainer",\n "company": {\n "$Type": "jetsons.company"\n },\n "competitors": {\n "$Collection": true,\n "$Type": "jetsons.company"\n }\n },\n "$EntityContainer": "jetsons.Service"\n }\n}\n'})}),"\n",(0,i.jsx)(n.h2,{id:"types",children:"Types"}),"\n",(0,i.jsxs)(n.p,{children:["Types are defined within a namespace. The namespace defined for this service is ",(0,i.jsx)(n.code,{children:"jetsons"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["Within the ",(0,i.jsx)(n.code,{children:"jetsons"})," namespace two types are defined: ",(0,i.jsx)(n.code,{children:"company"})," and ",(0,i.jsx)(n.code,{children:"employee"}),"."]}),"\n",(0,i.jsx)(n.h2,{id:"properties",children:"Properties"}),"\n",(0,i.jsx)(n.h3,{id:"meta-properties",children:"Meta Properties"}),"\n",(0,i.jsxs)(n.p,{children:["Properties representing meta information about the model, such as key, type, kind, collection, contains target,\nand entity container, are prefixed with a dollar sign (",(0,i.jsx)(n.code,{children:"$"}),")."]}),"\n",(0,i.jsx)(n.h4,{id:"types-1",children:"Types"}),"\n",(0,i.jsxs)(n.p,{children:["By default, properties are strings.\nThe ",(0,i.jsx)(n.code,{children:"$Type"})," property specifies the type for the core ",(0,i.jsx)(n.code,{children:"Edm.String"}),", ",(0,i.jsx)(n.code,{children:"Edm.Int32"}),",\n",(0,i.jsx)(n.code,{children:"Edm.Double"}),", ",(0,i.jsx)(n.code,{children:"Edm.Boolean"}),", ",(0,i.jsx)(n.code,{children:"Edm.Date"}),", ",(0,i.jsx)(n.code,{children:"Edm.Time"}
1),", and ",(0,i.jsx)(n.code,{children:"Edm.DateTimeOffset"})," properties.\nMore advanced services may define stream, binary, geography, or geometry types."]}),"\n",(0,i.jsx)(n.h4,{id:"collections",children:"Collections"}),"\n",(0,i.jsxs)(n.p,{children:["Because the ",(0,i.jsx)(n.code,{children:"employee"})," type is used in a collection,\nit defines a property (",(0,i.jsx)(n.code,{children:"id"}),") as the key value for referencing instances within the collection."]}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"company"})," type has a property for navigating to a collection of employees.\nThe employees are contained within the company; that is, they do not exist in a separate top-level collection."]}),"\n",(0,i.jsx)(n.h3,{id:"dynamic-properties",children:"Dynamic Properties"}),"\n",(0,i.jsx)(n.p,{children:'Resources can also include properties not advertised in metadata.\nThese "dynamic" properties can be referenced in query options and included in result payloads,\njust like normal declared properties.'}),"\n",(0,i.jsx)(n.h2,{id:"service-entity-container",children:"Service Entity Container"}),"\n",(0,i.jsxs)(n.p,{children:["The last line defines the ",(0,i.jsx)(n.code,{children:"Service"})," entity container as the root of the service. Its members are top-level resources exposed by the service;\n",(0,i.jsx)(n.code,{children:"company"})," is a single instance of the ",(0,i.jsx)(n.code,{children:"company"})," type, and ",(0,i.jsx)(n.code,{children:"competitors"})," is a collection of companies."]})]})}function l(e={}){const{wrapper:n}={...(0,s.a)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(p,{...e})}):p(e)}},1670:(e,n,t)=>{t.d(n,{Z:()=>c,a:()=>o});var i=t(7378);const s={},r=i.createContext(s);function o(e){const n=i.useContext(r);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),i.createElement(r.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.