简体   繁体   中英

API - status response

In regards to Web service API,

You (developer) do a "GetPhoneNumberList" and the user has not added a phone number to his account, do you expect the API to response with status = "success" or "failure"?

No records will be returned because there is nothing to return.

(I would expect status to be success, since its not the developers fault)?

Based on what information you did give I can give an opinion, but it is not a very informed one since I do not know all the details.

Judging solely by the name of your method I conclude you are writing an API for retrieval. If I call GetPhoneNumberList I expect to receive some sort of sequence containing zero or more items. Thus, it seems perfectly reasonable that you might successfully retrieve zero phone numbers. Otherwise, how do I tell the difference between a user who set no phone numbers, and a program/network/database/security/etc error while retrieving the phone number?

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