Skip to content

Commit 041b3ff

Browse files
committed
refactor(profiles): rework role of, rules for missing profile parameter
1 parent 66871d0 commit 041b3ff

File tree

1 file changed

+19
-35
lines changed

1 file changed

+19
-35
lines changed

_format/1.1/index.md

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,47 +1986,31 @@ https://jsonapi.org/errors/profile-not-supported
19861986
> rules of the profile. This can fundamentally change the meaning of the
19871987
> server's response.
19881988
1989-
#### <a href="#profile-query-parameter-omitting" id="profile-query-parameter" class="headerlink"></a> Omitting the `profile` Query Parameter
1989+
#### <a href="#profile-query-parameter-omitting" id="profile-query-parameter-omitting" class="headerlink"></a> Omitting the `profile` Query Parameter
19901990

1991-
Requiring the client to specify the `profile` query parameter would be
1992-
cumbersome. Accordingly, JSON:API defines a way that server's may infer its
1993-
value in many cases.
1991+
Requiring the client to provide the `profile` query parameter would be
1992+
cumbersome. Accordingly, a server **MAY** advertise in its documentation that
1993+
certain profiles will be automatically applied to certain requests on the basis
1994+
of the request URI.
19941995

1995-
To do so, a server **MAY** define an internal mapping from query parameter names
1996-
to profile URIs. The profile URI for a query parameter name in this mapping
1997-
**MUST NOT** change over time.
1996+
For example, the server might say:
19981997

1999-
> Note: the server may choose to map all query parameter names from the same
2000-
> [family][query parameter family] to one profile URI. Or, it may choose to map
2001-
> only specific query parameter names.
1998+
> On all requests to URLs that match the pattern `/articles/:id`, the presence
1999+
> of a `version` query parameter will trigger the application of the
2000+
> `https://example.com/resource-versioning` profile.
20022001
2003-
If a requested URL does not contain the `profile` query parameter and does
2004-
contain one or more query parameters in the server's internal mapping, the
2005-
server may act as though the request URL contained a `profile` query parameter
2006-
whose value was the URI-encoded space-separated list of each unique profile URI
2007-
found in the server's internal mapping for the query parameters in use on the
2008-
request.
2002+
However, if a request contains the `profile` query parameter, and that parameter
2003+
lists a profile that defines a meaning for one of the query parameters in the
2004+
request URI ("parameter x"), the server **MUST NOT** apply a different profile
2005+
that also defines a meaning for parameter x.
20092006

2010-
For example, the server might support a profile that defines a meaning for the
2011-
values of the `page[cursor]` query parameter. Then, it could define its internal
2012-
param name to profile URI mapping like so:
2013-
2014-
```json
2015-
{ "page[cursor]": "https://example.com/pagination-profile" }
2016-
```
2017-
2018-
Accordingly, a request for:
2019-
2020-
```
2021-
https://example.com/?page[cursor]=xyz
2022-
```
2023-
2024-
would be interpreted by the server as:
2025-
2026-
```
2027-
https://example.com/?page[cursor]=xyz&profile=https://example.com/pagination-profile
2028-
```
2007+
Once the server advertises that a specific profile will be automatically applied
2008+
in certain cases, it **MUST** continue to apply that profile to those same cases
2009+
in the future.
20292010

2011+
When the server applies a profile to a request on the basis of the request's
2012+
URI, it **MUST** indicate that it has done so in the response's `Content-Type`
2013+
header and the response document's `profile` links.
20302014

20312015
### <a href="#profile-keywords-and-aliases" id="profile-keywords-and-aliases" class="headerlink"></a> Profile Keywords and Aliases
20322016

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy