@@ -1986,47 +1986,31 @@ https://jsonapi.org/errors/profile-not-supported
1986
1986
> rules of the profile. This can fundamentally change the meaning of the
1987
1987
> server's response.
1988
1988
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
1990
1990
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.
1994
1995
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:
1998
1997
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.
2002
2001
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.
2009
2006
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.
2029
2010
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.
2030
2014
2031
2015
### <a href =" #profile-keywords-and-aliases " id =" profile-keywords-and-aliases " class =" headerlink " ></a > Profile Keywords and Aliases
2032
2016
0 commit comments