简体   繁体   中英

Restful services, output type by extensions

We are developing "Restful" things. We use Jersey on OSGI (Adobe's CRX, which packs Apache Felix). The API Spec comes up with some thing dealing with conflicting restful requests, something like if the client sends the header Accept: application/json and the request url is http:// * /myresource.xml, we have to send json back (Jersey will send xml back).

Also it seems the main person (very high rank technical and knowledgeable person) said we shouldn't use the extension such as .xml or .json for a search (non-resource), ie, it is against the 'principle' to do something like "http://myrest/search.json?q=abc". Instead, we should do some thing like "http:// * /search?output=json&q=abc" ( Implementing such a spec just makes our lives hard since manipulating what a framework (Jersey) provides is not fun).

What is your opinion?

Why do you use a special URL at all? If the client sends the Accept: application/json he should get json. So how about using just http://myrest/search?q=abc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM