JSON-APIレスポンスに表示されるリンクのクエリパラメータがパーセントエンコードされる必要がありますか? jsonapi.orgからjson-api応答のリンクをエンコードする必要がありますか?
実施例は同様に、符号化されない:
GET /articles?include=author&fields[articles]=title,body&fields[people]=name HTTP/1.1
Accept: application/vnd.api+json
注:上記の例URI
{ "links": { "self": "http://example.com/articles", "next": "http://example.com/articles?page[offset]=2", "last": "http://example.com/articles?page[offset]=10" }, "data": [{ "type": "articles", "id": "1", "attributes": { "title": "JSON API paints my bikeshed!" } ] }
しかしながら、要求に符号化パラメータに関するメモが存在します読みやすくするために、エンコードされていない[と]文字を示しています。実際には、これらの文字は、RFC 3986の要件に従って%エンコードされている必要があります。
このメモは要求にのみ適用されますか?または応答も同様に、パーセントエンコードする必要があります:
{
"links": {
"self": "http://example.com/articles",
"next": "http://example.com/articles?page%5Boffset%5D=2",
"last": "http://example.com/articles?page%5Boffset%5D=10"
},
"data": [{
"type": "articles",
"id": "1",
"attributes": {
"title": "JSON API paints my bikeshed!"
}
]
}