The standard way to encode pagination information into a calm url?

I think my question will be better explained with a few examples ...

GET http: // myservice / myresource /? Name = xxx & country = xxxx & _page = 3 & _page_len = 10 & _order = name asc

that is, on the one hand, I have conditions (name = xxx & country = xxxx), and on the other hand I have parameters that affect the request (_page = 3 & _page_len = 10 & _order = name asc)

now, although I use a special prefix ("_" in the case) to avoid clashes between conditions and parameters (what if my resource has the "order" property?)

Is there a standard way to deal with these situations?

-

I found this example (just pick) http://www.peej.co.uk/articles/restfully-delicious.html

GET http://del.icio.us/api/peej/bookmarks/?tag=mytag&dt=2009-05-30&start=1&end=2

but in this case the condition fields are already defined (there is no initial and final property)

I am looking for some kind of general solution ...

- edit, a more detailed example to clarify

Each element is completely separate from each other ... let them say that my resources are clients, and that (fortunately) I have a couple of millions of them in my db.

so url might be something like

http: // myservice / customers /? country = argentina, last_operation = 2009-01-01. 2010-01-01

This should give me all the customers from Argentina who bought something last year.

ajax, , , , ,

,

http://...,_page=1,_page_len=10,_order=state,name

autosuggest ajax

http://...,_page=1,_page_len=100,_order=state,name,name=what_ever_type_the_user *

100 , , ...

, ( ) restfull url...

+3
4

, , ( ) - . , - .

+2

: . , , . , .


, , , :

  • ,

, - ( ... ). , , URL- . , / , , URL-. , :

http://.../myresource/page-10/3?name=xxx&country=yyy&order=name&orderby=asc

, . , URI , - page-10 - " 10 ", - . .

. . , , . , .

, , . , , URI . , URL- :

http://.../myresource/page-10/3?...#5
http://.../myresource/page-10/3/5?...

, . , IMHO .

, , - (, , ), URL- . . , URI, . , - :

http://.../myresource/item/42
http://.../myresource/item/307E8599-AD9B-4B32-8612-F8EAF754DFDB

, . , URI . , .

+2

, Web API Design ( Apigee) - -API. , .

" " (. 17):

. , .

/dogs?limit=25&offset=50
+2

, RESTful, , HTTP-, - RTSP. Range RTSP , .

, - . , . , . , :

myresource/name=xxx;country=xxx/orderby=name;order=asc/20/
myresource/name=xxx;country=xxx/orderby=name;order=asc/21/
myresource/name=xxx;country=xxx/orderby=name;order=asc/22/
myresource/name=xxx;country=xxx/orderby=name;order=asc/23/
myresource/name=xxx;country=xxx/orderby=name;order=asc/24/

, - - . URI , . , , , . , URI , . "" . , 404.

, ... HTTP- / .

+1
source

Source: https://habr.com/ru/post/1709435/


All Articles