开发者

What is best way to pass multiple query parameters to a restful api?

I am designing RESTful Api's and would like some advice on designing an API where the caller wants to query records based on more than one search parameter.

I have only seen restful apis that use one parameter.

how should i do this?

e.g. if i have created a restful api for a list of contacts, how would I format a call that returned all contacts with firstname==bob & surname==smith?

I guess it should be a GET because I am retrieving?

My only thoughts are:

http://api.myapi.com/contac开发者_如何转开发ts/firstname/bob&surname=smith

But that doesn't seem right ;-(

Please advice.

Also, do any of the php frameworks support this? e.g. symfony, konstrukt etc.


I think

http://api.myapi.com/contacts?firstname=bob&surname=smith

is the way to go if you have a set of parameters, all of which are optional.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜