diff --git a/docs/odata-json-format/odata-json-format.html b/docs/odata-json-format/odata-json-format.html index b8ebaa59..041937d7 100644 --- a/docs/odata-json-format/odata-json-format.html +++ b/docs/odata-json-format/odata-json-format.html @@ -237,24 +237,25 @@

Table of Contents

  • 5 Service Document
  • @@ -376,17 +377,17 @@

    -Section 4.5.1 +Section 4.6.1 Fragment portion of Context URL is not percent-encoded 368 -Section 4.5.8 +Section 4.6.8 Transient entities can be identifiable 1928 -Section 4.5.12 +Section 4.6.12 mediaContentType can be null 536 @@ -572,7 +573,13 @@

    4.2 Message B

    Client libraries MUST retain the order of objects within an array in JSON responses.

    -

    4.3 Relative URLs

    +

    4.3 URLs in Message Bodies

    +
    +

    URLs represented as a string within a JSON payload, including batch requests, must follow standard OData encoding rules as defined in OData-URL.

    +

    For relative URLs this means that colons (:) in the path part, especially within key values, MUST be percent-encoded to avoid confusion with the scheme separator. Colons within the query part, i.e. after the question mark character (?), need not be percent-encoded.

    +
    +
    +

    4.4 Relative URLs

    URLs present in a payload (whether request or response) MAY be represented as relative URLs.

    Relative URLs, other than those in type, are relative to their base URL, which is

    @@ -592,7 +599,6 @@

    4.3 Relati

    Processors expanding the URLs MUST use normal URL expansion rules as defined in RFC3986. This means that if the base URL is a context URL, the part starting with $metadata# is ignored when resolving the relative URL.

    Clients that receive relative URLs in response payloads SHOULD use the same relative URLs, where appropriate, in request payloads (such as bind operations and batch requests) and in system query options (such as $id).

    -

    URLs represented as a string within a JSON payload, including batch requests, must follow standard OData encoding rules. For relative URLs this means that colons in the path part, especially within key values, MUST be percent-encoded to avoid confusion with the scheme separator. Colons within the query part, i.e. after the question mark character (?), need not be percent-encoded.

    Example 2:

    {
    @@ -609,7 +615,7 @@ 

    4.3 Relati

    -

    4.4 Payload Ordering Constraints

    +

    4.5 Payload Ordering Constraints

    Ordering constraints MAY be imposed on the JSON payload in order to support streaming scenarios. These ordering constraints MUST only be assumed if explicitly specified as some clients (and services) might not be able to control, or might not care about, the order of the JSON properties in the payload.

    Clients can request that a JSON response conform to these ordering constraints by specifying a media type of application/json with the streaming=true parameter in the Accept header or $format query option. Services MUST return 406 Not Acceptable if the client only requests streaming and the service does not support it.

    @@ -635,14 +641,14 @@

    Note that in OData 4.0 the streaming format parameter was prefixed with odata.. Payloads with an OData-Version header equal to 4.0 MUST include the odata. prefix. Payloads with an OData-Version header equal to 4.01 or greater SHOULD NOT include the odata. prefix.

    -

    4.5 Control Information

    +

    4.6 Control Information

    In addition to the “pure data” a message body MAY contain annotations and control information that is represented as name/value pairs whose names start with @.

    In requests and responses with an OData-Version header with a value of 4.0 control information names are prefixed with @odata., e.g. @odata.context. In requests and responses without such a header the odata. prefix SHOULD be omitted, e.g. @context.

    In some cases, control information is required in request payloads; this is called out in the following subsections.

    Receivers that encounter unknown annotations in any namespace or unknown control information MUST NOT stop processing and MUST NOT signal an error.

    -

    4.5.1 Control Information: context (odata.context)

    +

    4.6.1 Control Information: context (odata.context)

    The context control information returns the context URL (see OData-Protocol) for the payload. This URL can be absolute or relative. The fragment portion of the context URL MUST NOT be percent-encoded.

    The context control information is not returned if metadata=none is requested. Otherwise it MUST be the first property of any JSON response that allows this control information (this excludes for example error responses).

    @@ -659,13 +665,13 @@

    4.5.2 Control Information: metadataEtag (odata.metadataEtag)

    +

    4.6.2 Control Information: metadataEtag (odata.metadataEtag)

    The metadataEtag control information MAY appear in a response in order to specify the entity tag (ETag) that can be used to determine the version of the metadata of the response. If an ETag is returned when requesting the metadata document, then the service SHOULD set the metadataEtag control information to the metadata document's ETag in all responses when using metadata=minimal or metadata=full. If no ETag is returned when requesting the metadata document, then the service SHOULD NOT set the metadataEtag control information in any responses.

    For details on how ETags are used, see OData-Protocol.

    -

    4.5.3 Control Information: type (odata.type)

    +

    4.6.3 Control Information: type (odata.type)

    The type control information specifies the type of a JSON object or name/value pair. Its value is a URI that identifies the type of the property or object. For built-in primitive types the value is the unqualified name of the primitive type. For payloads described by an OData-Version header with a value of 4.0, this name MUST be prefixed with the hash symbol (#); for non-OData 4.0 payloads, built-in primitive type values SHOULD be represented without the hash symbol, but consumers of 4.01 or greater payloads MUST support values with or without the hash symbol. For all other types, the URI may be absolute or relative to the type of the containing object. The root type may be absolute or relative to the root context URL.

    If the URI references a metadata document (that is, it’s not just a fragment), it MAY refer to a specific version of that metadata document using the $schemaversion system query option defined in OData-Protocol.

    @@ -707,28 +713,28 @@

    4.5.4 Control Information: count (odata.count)

    +

    4.6.4 Control Information: count (odata.count)

    The count control information occurs only in responses and can annotate any collection, see OData-Protocol section 11.2.5.5 System Query Option $count. Its value is an Edm.Int64 value corresponding to the total count of members in the collection represented by the request.

    - + -

    The nextLink control information indicates that a response is only a subset of the requested collection. It contains a URL that allows retrieving the next subset of the requested collection.

    +

    The nextLink control information indicates that a response is only a subset of the requested collection. It contains a URL that allows retrieving the next subset of the requested collection.

    This control information can also be applied to expanded to-many navigation properties.

    -

    4.5.6 Control Information: delta (odata.delta)

    +

    4.6.6 Control Information: delta (odata.delta)

    The delta control information is applied to a collection-valued navigation property within an added/changed entity in a delta payload to represent changes in membership or value of nested entities.

    - + -

    The deltaLink control information contains a URL that can be used to retrieve changes to the current set of results. The deltaLink control information MUST only appear on the last page of results. A page of results MUST NOT have both a deltaLink control information and a nextLink control information.

    +

    The deltaLink control information contains a URL that can be used to retrieve changes to the current set of results. The deltaLink control information MUST only appear on the last page of results. A page of results MUST NOT have both a deltaLink control information and a nextLink control information.

    -

    4.5.8 Control Information: id (odata.id)

    +

    4.6.8 Control Information: id (odata.id)

    The id control information contains the entity-id, see OData-Protocol. By convention the entity-id is identical to the canonical URL of the entity, as defined in OData-URL.

    The id control information MUST appear in responses if metadata=full is requested, or if metadata=minimal is requested and any of a non-transient entity’s key fields are omitted from the response or the entity-id is not identical to the canonical URL of the entity after

    @@ -742,9 +748,9 @@

    4.5.9 Control Information: editLink and readLink (odata.editLink and odata.readLink)

    + -

    The editLink control information contains the edit URL of the entity; see OData-Protocol.

    +

    The editLink control information contains the edit URL of the entity; see OData-Protocol.

    The readLink control information contains the read URL of the entity or collection; see OData-Protocol.

    The editLink and readLink control information is ignored in request payloads and not written in responses if metadata=none is requested.

    The default value of both the edit URL and read URL is the entity's entity-id appended with a cast segment to the type of the entity if its type is derived from the declared type of the entity set. If neither the editLink nor the readLink control information is present in an entity, the client uses this default value for the edit URL.

    @@ -765,26 +771,26 @@ +

    4.6.10 Control Information: etag (odata.etag)

    The etag control information MAY be applied to an entity or collection in a response. The value of the control information is an entity tag (ETag) which is an opaque string value that can be used in a subsequent request to determine if the value of the entity or collection has changed.

    For details on how ETags are used, see OData-Protocol.

    The etag control information is ignored in request payloads for single entities and not written in responses if metadata=none is requested.

    - + -

    The navigationLink control information in a response contains a navigation URL that can be used to retrieve an entity or collection of entities related to the current entity via a navigation property.

    +

    The navigationLink control information in a response contains a navigation URL that can be used to retrieve an entity or collection of entities related to the current entity via a navigation property.

    The default computed value of a navigation URL is the value of the read URL appended with a segment containing the name of the navigation property. The service MAY omit the navigationLink control information if metadata=minimal has been specified on the request and the navigation link matches this computed value.

    The associationLink control information in a response contains an association URL that can be used to retrieve a reference to an entity or a collection of references to entities related to the current entity via a navigation property.

    The default computed value of an association URL is the value of the navigation URL appended with /$ref. The service MAY omit the associationLink control information if the association link matches this computed value.

    The navigationLink and associationLink control information is ignored in request payloads and not written in responses if metadata=none is requested.

    -

    4.5.12 Control Information: media* (odata.media*)

    +

    4.6.12 Control Information: media* (odata.media*)

    For media entities and stream properties at least one of the control information mediaEditLink and mediaReadLink MUST be included in responses if they don't follow standard URL conventions as defined in OData-URL, sections 4.6 Addressing a property and 4.14 Addressing the Media Stream of a Media Entity, or if metadata=full is requested.

    -

    The mediaEditLink control information contains a URL that can be used to update the binary stream associated with the media entity or stream property. It MUST be included for updatable streams if it differs from standard URL conventions relative to the edit link of the entity.

    +

    The mediaEditLink control information contains a URL that can be used to update the binary stream associated with the media entity or stream property. It MUST be included for updatable streams if it differs from standard URL conventions relative to the edit link of the entity.

    The mediaReadLink control information contains a URL that can be used to read the binary stream associated with the media entity or stream property. It MUST be included if its value differs from the value of the associated mediaEditLink, if present, or if it doesn’t follow standard URL conventions relative to the read link of the entity and the associated mediaEditLink is not present.

    The mediaContentType control information MAY be included; its value SHOULD match the media type of the binary stream represented by the mediaReadLink URL. This is only a hint; the actual media type will be included in the Content-Type header when the resource is requested. The presence of mediaContentType with value null MAY be used to indicate the absence of a binary stream.

    The mediaEtag control information MAY be included; its value is the ETag of the binary stream represented by this media entity or stream property.

    @@ -804,12 +810,12 @@

    4.5.13 Control Information: removed (odata.removed)

    +

    4.6.13 Control Information: removed (odata.removed)

    The removed control information is used in delta payloads and indicates that the represented entity is (to be) deleted.

    -

    4.5.14 Control Information: collectionAnnotations (odata.collectionAnnotations)

    +

    4.6.14 Control Information: collectionAnnotations (odata.collectionAnnotations)

    The collectionAnnotations control information can be applied to a collection containing primitive members in order to annotate such primitive members. The value of the collectionAnnotations control information is an array of JSON objects containing an integer property index, specifying the zero-based ordinal index of the primitive item within the collection, along with any annotations that are to be applied to that primitive collection member.

    @@ -2585,9 +2591,9 @@

    23 Conformance
  • defined in this specification (client)
  • exposed by the service (service)
  • -
  • MUST interpret all odata control information defined according to the OData-Version header of the payload (section 4.5)
  • +
  • MUST interpret all odata control information defined according to the OData-Version header of the payload (section 4.6)
  • MUST be prepared to receive any annotations and control information not defined in the OData-Version header of the payload (section 20)
  • -
  • MUST NOT require streaming=true in the Content-Type header (section 4.4)
  • +
  • MUST NOT require streaming=true in the Content-Type header (section 4.5)
  • MUST be a conforming consumer of the OData 4.0 JSON format, for payloads with an OData-Version header value of 4.0.
    1. MUST accept the odata. prefix, where defined, on format parameters and control information
    2. @@ -2637,12 +2643,12 @@

      23 Conformance
    3. MUST support the application/json media type in the Accept header (section 3)
    4. MUST return well-formed JSON payloads
    5. MUST support odata.metadata=full (section 3.1.2)
    6. -
    7. MUST include the odata.nextLink control information in partial results for entity collections (section 4.5.5)
    8. -
    9. MUST support entity instances with external metadata (section 4.5.1)
    10. -
    11. MUST support properties with externally defined data types (section 4.5.3)
    12. +
    13. MUST include the odata.nextLink control information in partial results for entity collections (section 4.6.5)
    14. +
    15. MUST support entity instances with external metadata (section 4.6.1)
    16. +
    17. MUST support properties with externally defined data types (section 4.6.3)
    18. MUST NOT violate any other aspects of this OData JSON specification
    19. SHOULD support the $format system query option (section 3)
    20. -
    21. MAY support the odata.streaming=true parameter in the Accept header (section 4.4)
    22. +
    23. MAY support the odata.streaming=true parameter in the Accept header (section 4.5)
    24. MAY return full metadata regardless of odata.metadata (section 3.1.2)
    25. MUST NOT omit null or default values unless the omit-values preference is specified in the Prefer request header and the omit-values preference is included in the Preference-Applied response header
    26. MUST return OData JSON 4.0-compliant responses for requests with an OData-MaxVersion header value of 4.0
    27. diff --git a/docs/odata-json-format/odata-json-format.md b/docs/odata-json-format/odata-json-format.md index 1e8f3462..9eef6276 100644 --- a/docs/odata-json-format/odata-json-format.md +++ b/docs/odata-json-format/odata-json-format.md @@ -109,23 +109,24 @@ For complete copyright information please see the full Notices section in an App - [4 Common Characteristics](#CommonCharacteristics) - [4.1 Header Content-Type](#HeaderContentType) - [4.2 Message Body](#MessageBody) - - [4.3 Relative URLs](#RelativeURLs) - - [4.4 Payload Ordering Constraints](#PayloadOrderingConstraints) - - [4.5 Control Information](#ControlInformation) - - [4.5.1 Control Information: `context` (`odata.context`)](#ControlInformationcontextodatacontext) - - [4.5.2 Control Information: `metadataEtag` (`odata.metadataEtag`)](#ControlInformationmetadataEtagodatametadataEtag) - - [4.5.3 Control Information: `type` (`odata.type`)](#ControlInformationtypeodatatype) - - [4.5.4 Control Information: `count` (`odata.count`)](#ControlInformationcountodatacount) - - [4.5.5 Control Information: `nextLink` (`odata.nextLink`)](#ControlInformationnextLinkodatanextLink) - - [4.5.6 Control Information: `delta` (`odata.delta`)](#ControlInformationdeltaodatadelta) - - [4.5.7 Control Information: `deltaLink` (`odata.deltaLink`)](#ControlInformationdeltaLinkodatadeltaLink) - - [4.5.8 Control Information: `id` (`odata.id`)](#ControlInformationidodataid) - - [4.5.9 Control Information: `editLink` and `readLink` (`odata.editLink` and `odata.readLink`)](#ControlInformationeditLinkandreadLinkodataeditLinkandodatareadLink) - - [4.5.10 Control Information: `etag` (`odata.etag`)](#ControlInformationetagodataetag) - - [4.5.11 Control Information: `navigationLink` and `associationLink` (`odata.navigationLink` and `odata.associationLink`)](#ControlInformationnavigationLinkandassociationLinkodatanavigationLinkandodataassociationLink) - - [4.5.12 Control Information: `media*` (`odata.media*`)](#ControlInformationmediaodatamedia) - - [4.5.13 Control Information: `removed` (`odata.removed`)](#ControlInformationremovedodataremoved) - - [4.5.14 Control Information: `collectionAnnotations` (`odata.collectionAnnotations`)](#ControlInformationcollectionAnnotationsodatacollectionAnnotations) + - [4.3 URLs in Message Bodies](#URLsinMessageBodies) + - [4.4 Relative URLs](#RelativeURLs) + - [4.5 Payload Ordering Constraints](#PayloadOrderingConstraints) + - [4.6 Control Information](#ControlInformation) + - [4.6.1 Control Information: `context` (`odata.context`)](#ControlInformationcontextodatacontext) + - [4.6.2 Control Information: `metadataEtag` (`odata.metadataEtag`)](#ControlInformationmetadataEtagodatametadataEtag) + - [4.6.3 Control Information: `type` (`odata.type`)](#ControlInformationtypeodatatype) + - [4.6.4 Control Information: `count` (`odata.count`)](#ControlInformationcountodatacount) + - [4.6.5 Control Information: `nextLink` (`odata.nextLink`)](#ControlInformationnextLinkodatanextLink) + - [4.6.6 Control Information: `delta` (`odata.delta`)](#ControlInformationdeltaodatadelta) + - [4.6.7 Control Information: `deltaLink` (`odata.deltaLink`)](#ControlInformationdeltaLinkodatadeltaLink) + - [4.6.8 Control Information: `id` (`odata.id`)](#ControlInformationidodataid) + - [4.6.9 Control Information: `editLink` and `readLink` (`odata.editLink` and `odata.readLink`)](#ControlInformationeditLinkandreadLinkodataeditLinkandodatareadLink) + - [4.6.10 Control Information: `etag` (`odata.etag`)](#ControlInformationetagodataetag) + - [4.6.11 Control Information: `navigationLink` and `associationLink` (`odata.navigationLink` and `odata.associationLink`)](#ControlInformationnavigationLinkandassociationLinkodatanavigationLinkandodataassociationLink) + - [4.6.12 Control Information: `media*` (`odata.media*`)](#ControlInformationmediaodatamedia) + - [4.6.13 Control Information: `removed` (`odata.removed`)](#ControlInformationremovedodataremoved) + - [4.6.14 Control Information: `collectionAnnotations` (`odata.collectionAnnotations`)](#ControlInformationcollectionAnnotationsodatacollectionAnnotations) - [5 Service Document](#ServiceDocument) - [6 Entity](#Entity) - [7 Structural Property](#StructuralProperty) @@ -215,9 +216,9 @@ An OData JSON payload may represent: Section | Feature / Change | Issue --------|------------------|------ -[Section 4.5.1](#ControlInformationcontextodatacontext)| Fragment portion of Context URL is not percent-encoded| [368](https://github.com/oasis-tcs/odata-specs/issues/368) -[Section 4.5.8](#ControlInformationidodataid)| Transient entities can be identifiable| [1928](https://github.com/oasis-tcs/odata-specs/issues/1928) -[Section 4.5.12](#ControlInformationmediaodatamedia)| `mediaContentType` can be `null`| [536](https://github.com/oasis-tcs/odata-specs/issues/536) +[Section 4.6.1](#ControlInformationcontextodatacontext)| Fragment portion of Context URL is not percent-encoded| [368](https://github.com/oasis-tcs/odata-specs/issues/368) +[Section 4.6.8](#ControlInformationidodataid)| Transient entities can be identifiable| [1928](https://github.com/oasis-tcs/odata-specs/issues/1928) +[Section 4.6.12](#ControlInformationmediaodatamedia)| `mediaContentType` can be `null`| [536](https://github.com/oasis-tcs/odata-specs/issues/536) [Section 7](#StructuralProperty), [Section A.2](#InformativeReferences)| Removed reference to obsolete version of GeoJSON| [456](https://github.com/oasis-tcs/odata-specs/issues/456) [Section 18](#ActionInvocation)| Allow common expressions in action payloads| [341](https://github.com/oasis-tcs/odata-specs/issues/341) @@ -596,7 +597,17 @@ result](#DeltaPayload). Client libraries MUST retain the order of objects within an array in JSON responses. -## 4.3 Relative URLs +## 4.3 URLs in Message Bodies + +URLs represented as a string within a JSON payload, including [batch +requests](#BatchRequest), must follow standard OData encoding rules as defined in [OData-URL](#ODataURL). + +For [relative URLs](#RelativeURLs) this means that colons (`:`) in the path part, especially +within key values, MUST be percent-encoded to avoid confusion with the +scheme separator. Colons within the query part, i.e. after the question +mark character (`?`), need not be percent-encoded. + +## 4.4 Relative URLs URLs present in a payload (whether request or response) MAY be represented as relative URLs. @@ -636,13 +647,6 @@ same relative URLs, where appropriate, in request payloads (such as [bind operations](#BindOperation) and batch requests) and in system query options (such as `$id`). -URLs represented as a string within a JSON payload, including [batch -requests](#BatchRequest), must follow standard OData encoding rules. -For relative URLs this means that colons in the path part, especially -within key values, MUST be percent-encoded to avoid confusion with the -scheme separator. Colons within the query part, i.e. after the question -mark character (`?`), need not be percent-encoded. - ::: example Example 2: ```json @@ -663,7 +667,7 @@ http://host/service/Customers('ALFKI')/Orders ``` ::: -## 4.4 Payload Ordering Constraints +## 4.5 Payload Ordering Constraints Ordering constraints MAY be imposed on the JSON payload in order to support streaming scenarios. These ordering constraints MUST only be @@ -733,7 +737,7 @@ Note that in OData 4.0 the `streaming` format parameter was prefixed with `OData-Version` header equal to `4.01` or greater SHOULD NOT include the `odata.` prefix. -## 4.5 Control Information +## 4.6 Control Information In addition to the "pure data" a message body MAY contain [annotations](#InstanceAnnotations) and control information that is @@ -752,7 +756,7 @@ Receivers that encounter unknown annotations in any namespace or unknown control information MUST NOT stop processing and MUST NOT signal an error. -### 4.5.1 Control Information: `context` (`odata.context`) +### 4.6.1 Control Information: `context` (`odata.context`) The `context` control information returns the context URL (see [OData-Protocol](#ODataProtocol)) for the @@ -785,7 +789,7 @@ Example 4: ``` ::: -### 4.5.2 Control Information: `metadataEtag` (`odata.metadataEtag`) +### 4.6.2 Control Information: `metadataEtag` (`odata.metadataEtag`) The `metadataEtag` control information MAY appear in a response in order to specify the entity tag (ETag) that can be used to @@ -802,7 +806,7 @@ in any responses. For details on how ETags are used, see [OData-Protocol](#ODataProtocol). -### 4.5.3 Control Information: `type` (`odata.type`) +### 4.6.3 Control Information: `type` (`odata.type`) The `type` control information specifies the type of a JSON object or name/value pair. Its value is a URI that identifies the type @@ -906,7 +910,7 @@ metadata document of a different service ``` ::: -### 4.5.4 Control Information: `count` (`odata.count`) +### 4.6.4 Control Information: `count` (`odata.count`) The `count` control information occurs only in responses and can annotate any collection, see [OData-Protocol](#ODataProtocol) @@ -915,25 +919,25 @@ section 11.2.5.5 System Query Option `Edm.Int64` value corresponding to the total count of members in the collection represented by the request. -### 4.5.5 Control Information: `nextLink` (`odata.nextLink`) +### 4.6.5 Control Information: `nextLink` (`odata.nextLink`) The `nextLink` control information indicates that a response -is only a subset of the requested collection. It contains a URL that +is only a subset of the requested collection. It contains a [URL](URLsinMessageBodies) that allows retrieving the next subset of the requested collection. This control information can also be applied to [expanded to-many navigation properties](#ExpandedNavigationProperty). -### 4.5.6 Control Information: `delta` (`odata.delta`) +### 4.6.6 Control Information: `delta` (`odata.delta`) The `delta` control information is applied to a collection-valued navigation property within an [added/changed entity](#AddedChangedEntity) in a delta payload to represent changes in membership or value of nested entities. -### 4.5.7 Control Information: `deltaLink` (`odata.deltaLink`) +### 4.6.7 Control Information: `deltaLink` (`odata.deltaLink`) -The `deltaLink` control information contains a URL that can +The `deltaLink` control information contains a [URL](URLsinMessageBodies) that can be used to retrieve changes to the current set of results. The `deltaLink` control information MUST only appear on the last page of results. A page of results MUST NOT have both a @@ -941,7 +945,7 @@ page of results. A page of results MUST NOT have both a [`nextLink`](#ControlInformationnextLinkodatanextLink) control information. -### 4.5.8 Control Information: `id` (`odata.id`) +### 4.6.8 Control Information: `id` (`odata.id`) The `id` control information contains the entity-id, see [OData-Protocol](#ODataProtocol). By convention the entity-id is @@ -982,10 +986,10 @@ The `id` control information MUST NOT appear for a collection. Its meaning in this context is reserved for future versions of this specification. -### 4.5.9 Control Information: `editLink` and `readLink` (`odata.editLink` and `odata.readLink`) +### 4.6.9 Control Information: `editLink` and `readLink` (`odata.editLink` and `odata.readLink`) The `editLink` control information contains -the edit URL of the entity; see [OData-Protocol](#ODataProtocol). +the edit [URL](URLsinMessageBodies) of the entity; see [OData-Protocol](#ODataProtocol). The `readLink` control information contains the read URL of the entity or collection; see [OData-Protocol](#ODataProtocol). @@ -1034,7 +1038,7 @@ For collections: meaning in this context is reserved for future versions of this specification. -### 4.5.10 Control Information: `etag` (`odata.etag`) +### 4.6.10 Control Information: `etag` (`odata.etag`) The `etag` control information MAY be applied to an [entity](#Entity) or collection in a response. The @@ -1048,10 +1052,10 @@ The `etag` control information is ignored in request payloads for single entities and not written in responses if [`metadata=none`](#metadatanoneodatametadatanone) is requested. -### 4.5.11 Control Information: `navigationLink` and `associationLink` (`odata.navigationLink` and `odata.associationLink`) +### 4.6.11 Control Information: `navigationLink` and `associationLink` (`odata.navigationLink` and `odata.associationLink`) The `navigationLink` control information in a -response contains a _navigation URL_ that can be used to retrieve an +response contains a _navigation [URL](URLsinMessageBodies)_ that can be used to retrieve an entity or collection of entities related to the current entity via a [navigation property](#NavigationProperty). @@ -1077,7 +1081,7 @@ The `navigationLink` and `associationLink` control information is ignored in request payloads and not written in responses if [`metadata=none`](#metadatanoneodatametadatanone) is requested. -### 4.5.12 Control Information: `media*` (`odata.media*`) +### 4.6.12 Control Information: `media*` (`odata.media*`) For [media entities](#MediaEntity) and [stream properties](#StreamProperty) at least one of the control information @@ -1087,7 +1091,7 @@ in [OData-URL](#ODataURL), sections 4.6 Addressing a property and 4.14 Addressin [`metadata=full`](#metadatafullodatametadatafull) is requested. -The `mediaEditLink` control information contains a URL that +The `mediaEditLink` control information contains a [URL](URLsinMessageBodies) that can be used to update the binary stream associated with the media entity or stream property. It MUST be included for updatable streams if it differs from standard URL conventions relative to the edit link of the @@ -1144,13 +1148,13 @@ Example 7: ``` ::: -### 4.5.13 Control Information: `removed` (`odata.removed`) +### 4.6.13 Control Information: `removed` (`odata.removed`) The `removed` control information is used in [delta payloads](#DeletedEntity) and indicates that the represented entity is (to be) deleted. -### 4.5.14 Control Information: `collectionAnnotations` (`odata.collectionAnnotations`) +### 4.6.14 Control Information: `collectionAnnotations` (`odata.collectionAnnotations`) The `collectionAnnotations` control information can be applied to a collection containing primitive members in order to @@ -4035,9 +4039,9 @@ In order to be a conforming consumer of the OData JSON format, a client or servi 3. MUST be prepared to receive all data types ([section 7.1](#PrimitiveValue)) 1. defined in this specification (client) 2. exposed by the service (service) -4. MUST interpret all `odata` control information defined according to the `OData-Version` header of the payload ([section 4.5](#ControlInformation)) +4. MUST interpret all `odata` control information defined according to the `OData-Version` header of the payload ([section 4.6](#ControlInformation)) 5. MUST be prepared to receive any annotations and control information not defined in the `OData-Version` header of the payload ([section 20](#InstanceAnnotations)) -6. MUST NOT require `streaming=true` in the `Content-Type` header ([section 4.4](#PayloadOrderingConstraints)) +6. MUST NOT require `streaming=true` in the `Content-Type` header ([section 4.5](#PayloadOrderingConstraints)) 7. MUST be a conforming consumer of the OData 4.0 JSON format, for payloads with an `OData-Version` header value of `4.0`. 1. MUST accept the `odata.` prefix, where defined, on format parameters and control information 2. MUST accept the `#` prefix in `@odata.type` values @@ -4079,12 +4083,12 @@ In addition, in order to conform to the OData JSON format, a service: 12. MUST support the `application/json` media type in the `Accept` header ([section 3](#RequestingtheJSONFormat)) 13. MUST return well-formed JSON payloads 14. MUST support `odata.metadata=full` ([section 3.1.2](#metadatafullodatametadatafull)) -15. MUST include the `odata.nextLink` control information in partial results for entity collections ([section 4.5.5](#ControlInformationnextLinkodatanextLink)) -16. MUST support entity instances with external metadata ([section 4.5.1](#ControlInformationcontextodatacontext)) -17. MUST support properties with externally defined data types ([section 4.5.3](#ControlInformationtypeodatatype)) +15. MUST include the `odata.nextLink` control information in partial results for entity collections ([section 4.6.5](#ControlInformationnextLinkodatanextLink)) +16. MUST support entity instances with external metadata ([section 4.6.1](#ControlInformationcontextodatacontext)) +17. MUST support properties with externally defined data types ([section 4.6.3](#ControlInformationtypeodatatype)) 18. MUST NOT violate any other aspects of this OData JSON specification 19. SHOULD support the `$format` system query option ([section 3](#RequestingtheJSONFormat)) -20. MAY support the `odata.streaming=true` parameter in the `Accept` header ([section 4.4](#PayloadOrderingConstraints)) +20. MAY support the `odata.streaming=true` parameter in the `Accept` header ([section 4.5](#PayloadOrderingConstraints)) 21. MAY return full metadata regardless of `odata.metadata` ([section 3.1.2](#metadatafullodatametadatafull)) 22. MUST NOT omit null or default values unless the `omit-values` preference is specified in the `Prefer` request header and the `omit-values` preference is included in the `Preference-Applied` response header 23. MUST return OData JSON 4.0-compliant responses for requests with an `OData-MaxVersion` header value of `4.0` diff --git a/odata-json-format/4 Common Characteristics.md b/odata-json-format/4 Common Characteristics.md index 32f7f92e..5e1d93d4 100644 --- a/odata-json-format/4 Common Characteristics.md +++ b/odata-json-format/4 Common Characteristics.md @@ -49,6 +49,16 @@ result](#DeltaPayload). Client libraries MUST retain the order of objects within an array in JSON responses. +## ##subsec URLs in Message Bodies + +URLs represented as a string within a JSON payload, including [batch +requests](#BatchRequest), must follow standard OData encoding rules as defined in [OData-URL](#ODataURL). + +For [relative URLs](#RelativeURLs) this means that colons (`:`) in the path part, especially +within key values, MUST be percent-encoded to avoid confusion with the +scheme separator. Colons within the query part, i.e. after the question +mark character (`?`), need not be percent-encoded. + ## ##subsec Relative URLs URLs present in a payload (whether request or response) MAY be @@ -89,13 +99,6 @@ same relative URLs, where appropriate, in request payloads (such as [bind operations](#BindOperation) and batch requests) and in system query options (such as `$id`). -URLs represented as a string within a JSON payload, including [batch -requests](#BatchRequest), must follow standard OData encoding rules. -For relative URLs this means that colons in the path part, especially -within key values, MUST be percent-encoded to avoid confusion with the -scheme separator. Colons within the query part, i.e. after the question -mark character (`?`), need not be percent-encoded. - ::: example Example ##ex: ```json @@ -371,7 +374,7 @@ the total count of members in the collection represented by the request. ### ##subsubsec Control Information: `nextLink` (`odata.nextLink`) The `nextLink` control information indicates that a response -is only a subset of the requested collection. It contains a URL that +is only a subset of the requested collection. It contains a [URL](URLsinMessageBodies) that allows retrieving the next subset of the requested collection. This control information can also be applied to [expanded to-many @@ -386,7 +389,7 @@ in membership or value of nested entities. ### ##subsubsec Control Information: `deltaLink` (`odata.deltaLink`) -The `deltaLink` control information contains a URL that can +The `deltaLink` control information contains a [URL](URLsinMessageBodies) that can be used to retrieve changes to the current set of results. The `deltaLink` control information MUST only appear on the last page of results. A page of results MUST NOT have both a @@ -438,7 +441,7 @@ of this specification. ### ##subsubsec Control Information: `editLink` and `readLink` (`odata.editLink` and `odata.readLink`) The `editLink` control information contains -the edit URL of the entity; see [OData-Protocol](#ODataProtocol). +the edit [URL](URLsinMessageBodies) of the entity; see [OData-Protocol](#ODataProtocol). The `readLink` control information contains the read URL of the entity or collection; see [OData-Protocol](#ODataProtocol). @@ -504,7 +507,7 @@ single entities and not written in responses if ### ##subsubsec Control Information: `navigationLink` and `associationLink` (`odata.navigationLink` and `odata.associationLink`) The `navigationLink` control information in a -response contains a _navigation URL_ that can be used to retrieve an +response contains a _navigation [URL](URLsinMessageBodies)_ that can be used to retrieve an entity or collection of entities related to the current entity via a [navigation property](#NavigationProperty). @@ -540,7 +543,7 @@ in [OData-URL](#ODataURL), sections 4.6 Addressing a property and 4.14 Addressin [`metadata=full`](#metadatafullodatametadatafull) is requested. -The `mediaEditLink` control information contains a URL that +The `mediaEditLink` control information contains a [URL](URLsinMessageBodies) that can be used to update the binary stream associated with the media entity or stream property. It MUST be included for updatable streams if it differs from standard URL conventions relative to the edit link of the