100
68

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

パスパラメータとクエリパラメーターの違い

Posted at

パスパラメータとクエリパラメーターの違い

http://example.com/path/param1/param2?query=param3

■ パスパラメータ
param1、param2

■ クエリパラメーター
param3

で、何が違うの?

1. 一意なリソースを表すのに必要な情報かどうか 
2. 省略可能かどうか

一意なリソースを表す場合はパスパラメータに入れる。
一意なリソースとは例えばユーザーIDとか

省略可能ならクエリパラメーターに入れる。
例えばクエリパラメータの部分を省略した以下のURLでも正常にアクセスできます。

http://example.com/path/param1/param2
100
68
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
100
68

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?