api - Rest best practices : How to use an url as parameter -



api - Rest best practices : How to use an url as parameter -

i trying design rest api, , have question 1 method in particular :

this method read-only. returns info no modification on server side this method (obviously) idempotent one of parameter callback url

as used info retrieval, first tempted utilize get verb :

// braces here highlight {variables} http://api.com/foo/{someid}/bar/{http://myawesome.com/callbackurl} // or http://api.com/foo/{someid}/bar?callback={http://myawesome.com/callbackurl}

but seems ugly. url contain lot of forwards slashes can hinder api's visibility.

so why not using post or put ? if callbackurl has parameters of own ?

what best solution ?

if need pass url in url utilize query-parameter , encode url. here illustration how google adds url of search result url.

http://www.google.de/url?...&url=http%3a%2f%2fstackoverflow.com%2f

i don't think ugly of import point designing restful api. much more of import how api helps client interact it. google here. homecoming result of urls , decide means of description 1 use.

api rest spring-mvc design

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -