简体   繁体   中英

REST API DESIGN: POST OR GET when a URL is the query parameter

I am writing an API and it will support a query where a URL will be the query term, eg: return the id of a document that has the data {"url":"http://google.com/directory/directory/document/index.html"}

the API url would be something like this /document/getid

From my reading GET should be used to do queries but when the query could be very long URL, is that still the best option, I am considering using POST but I want to follow API design best practices.

我决定对URL进行md5哈希并将其存储为文档中的字段

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