Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 我的数据库应该通过RESTAPI公开吗_Asp.net_Spring_Rest_Asp.net Web Api - Fatal编程技术网

Asp.net 我的数据库应该通过RESTAPI公开吗

Asp.net 我的数据库应该通过RESTAPI公开吗,asp.net,spring,rest,asp.net-web-api,Asp.net,Spring,Rest,Asp.net Web Api,考虑到我只有一个名为entity的表,使用/entity URI来服务于该表的某些字段和另一个/entity/id/details路径来共享它们的完整或更大的表示形式是一种REST异端邪说?这取决于您的需求 一个好的开始可能是公开/entities资源, 并通过?字段属性实现该模式 示例: 如果实体字段为:id、名称、说明 /entities/{id}?fields=id,name 将返回一个仅包含id和名称的资源,但如果我不想通过这些字段参数公开表中的列,该怎么办?让客户端相信还有第二个名为

考虑到我只有一个名为entity的表,使用/entity URI来服务于该表的某些字段和另一个/entity/id/details路径来共享它们的完整或更大的表示形式是一种REST异端邪说?

这取决于您的需求

一个好的开始可能是公开
/entities
资源, 并通过
?字段
属性实现该模式

示例: 如果实体字段为:id、名称、说明

/entities/{id}?fields=id,name

将返回一个仅包含id和名称的资源,但如果我不想通过这些字段参数公开表中的列,该怎么办?让客户端相信还有第二个名为details的资源是个问题?