所以我是一名 Ruby 开发者,正在研究 C#,并试图弄清楚如何在我的端点上使用 Flurl。
这是我可以使用 Ruby 成功传递的 JSON。
{
type: "workorder.generated",
data: [{
id: order.id,
type: "orders"
},{
id: second_order.id,
type: "orders"
},{
id: bad_order.id,
type: "orders"
}
]
}
因此,将 C# 与 Flurl 结合使用时,我并不 100% 清楚如何构建它。
var response = await GetAPIPath()
.AppendPathSegment("yardlink_webhook")
.WithOAuthBearerToken(GetAPIToken())
.PostJsonAsync(new
{
type = "workorder.generated",
data = new
{
}
})
.ReceiveJson();
对于获取类似于 Ruby 示例的数据嵌套有什么帮助吗?
最佳答案
检查这个
var x = new
{
type = "workorder.generated",
data = new[]{ new {
id= 1,
type= "orders"
},new {
id= 2,
type= "orders"
},new {
id= 3,
type= "orders"
}
}
}
关于c# - 使用 Flurl 通过 POST 嵌套值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63946096/