Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.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
Xamarin.forms 向API Postrequest web API传递更多参数_Xamarin.forms_Xamarin.android - Fatal编程技术网

Xamarin.forms 向API Postrequest web API传递更多参数

Xamarin.forms 向API Postrequest web API传递更多参数,xamarin.forms,xamarin.android,Xamarin.forms,Xamarin.android,这是我的api,它需要两个参数 public void CreateRejectionChild([FromBody] IEnumerable<QMSRejectionChild> ChildData, string MasterId) { } 我不确定我是否正确通过了第二个物体?因为它给了我一个404错误作为回应 我将Api更改为 [HttpPost] [Route("api/Rej/MasterId/{MasterId}"

这是我的api,它需要两个参数

public void CreateRejectionChild([FromBody] IEnumerable<QMSRejectionChild> ChildData, string MasterId)
        {


         }
我不确定我是否正确通过了第二个物体?因为它给了我一个404错误作为回应

我将Api更改为

[HttpPost]
[Route("api/Rej/MasterId/{MasterId}")]
public string CreateRejectionChild([FromBody] IEnumerable<QMSRejectionChild> ChildData,[FromUri] string MasterId)
        {
         
        }
[HttpPost]
[路由(“api/Rej/MasterId/{MasterId}”)]
公共字符串CreateRejectionChild([FromBody]IEnumerable ChildData,[FromUri]字符串主ID)
{
}

我将第二个参数作为url传递,这对我很有用

通过在Url中传递Id,使用此帖子解决了问题!谢谢分享。你可以把它当作答案并接受它。
[HttpPost]
[Route("api/Rej/MasterId/{MasterId}")]
public string CreateRejectionChild([FromBody] IEnumerable<QMSRejectionChild> ChildData,[FromUri] string MasterId)
        {
         
        }