Web API与restfull Web API

编程入门 行业动态 更新时间:2024-10-18 01:38:04
本文介绍了Web API与restfull Web API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

所有web API的restfull或使用HTTP Verbs(GET,POST,PUT)实现API的那些都是被称为REST完整API。 如果web api满足所有其他REST constarints但没有使用HTTP Verbs(GET,POST,PUT)实现方法。这会被称为Restfull api。 我应该创建一个接口,以便我所有的api控制器都有相同的动作方法。 我尝试了什么: 我正在尝试创建一个新的web api。我有创建Web服务和WCF服务的经验。 现在尝试创建一个web api。因此,从设计的角度来看,restfull api应该只公开HTTP Verbs(GET,POST,PUT)方法。

解决方案

REST是一种用于实现API的方法。 Web API旨在成为RESTful框架,但您可以通过这种方式实现它。您可以以非平静的方式实施web api并仍然满足您的需求。 但是你是对的,RESTful的标准之一是实现HTTP动词,这是web api允许你轻松完成的事情。 我建议你阅读更多有关REST的内容,而不是使问题复杂化。 Web API完全能够创建RESTful API,但是一旦掌握了REST本身的概念,您就能够以这种方式创建API。 什么是REST? [ ^ ] 具象状态转移 - 维基百科 [ ^ ] http - RESTful编程究竟是什么? - 堆栈溢出 [ ^ ] 您知道什么是REST API吗? ? - SitePoint [ ^ ]

Are all web API's restfull or those which implements API using HTTP Verbs(GET,POST,PUT) are called REST full API. IF a web api satisfy all the other REST constarints but has'nt implemented methods using the HTTP Verbs(GET,POST,PUT). Will this be called a Restfull api. Should I create a interface so that all my api controllers will have same action methods. What I have tried: I am trying to create a new web api. I have experince in creating web services and WCF services. Now trying to create a web api. So from design point a restfull api should only expose the HTTP Verbs(GET,POST,PUT) methods.

解决方案

REST is a methodology for going about implementing an API. Web API is designed to be a RESTful framework but it is up to you to implement it that way. You could go about implementing web api in a non-restful manner and still have it meet your needs. But you are correct, one of the criteria of being RESTful is to implement HTTP verbs which is what web api allows you to do very easily. I would suggest you read up more on what REST is and not over complicate the issue. Web API is fully capable of creating a RESTful API but once you grasp the concepts of REST itself, then you'll be able to create the API in that manner. What is REST?[^] Representational state transfer - Wikipedia[^] http - What exactly is RESTful programming? - Stack Overflow[^] Do you know what a REST API is? — SitePoint[^]

更多推荐

Web API与restfull Web API

本文发布于:2023-11-02 17:07:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1552946.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Web   API   restfull

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!