网页API获取方法与复杂的对象作为参数 [英] Web API Get Method with Complex Object as Parameter

查看:128
本文介绍了网页API获取方法与复杂的对象作为参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何发送一个复杂的对象(可能有庞大的数据)到一个Web API获取方法?
我知道我可以用户FromUri'选项,但由于数据量过大我不能使用该选项。我想用户FromBody选项。但我可以发布数据到一个GET方法?????

请指引我在这里...在此先感谢


解决方案

  

如何将一个复杂的对象(可能有庞大的数据)发送到Web API获取方法?


您不能。 GET方法没有请求主体。你必须发送其中有局限性的查询字符串的一切。

您应该使用POST。

How to send a Complex Object( Which may have huge data) to a Web API Get Method? I know I can user 'FromUri' option, but since the data is too large I can't use that option. I want to user 'FromBody' option. But can I post data to a Get Method?????

Please guide me here...thanks in advance

解决方案

How to send a Complex Object( Which may have huge data) to a Web API Get Method?

You can't. GET methods do not have request body. You have to send everything in the query string which has limitations.

You should use POST instead.

这篇关于网页API获取方法与复杂的对象作为参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆