我正在使用Microsoft Dynamics WebAPI尝试POST
以下json。帖子返回成功,但在我的数据中没有设置ccseq_employeeid和ccseq_clientid。我需要更改什么才能使字段正确发布?
ccseq_expensetransaction
查找ccseq_expensetransactionsets
,其关系名称为ccseq_ccseq_expensetransactionset_ccseq_expensetransaction_ExpenseTransactionSetID
。对systemusers
和ccseq_clients
的查找是ccseq_expensetransaction
实体的一部分。
POST /api/data/v8.0/ccseq_expensetransactionsets HTTP/1.1
Host: url.com
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 24f7ead3-0307-996f-f45a-f959c604c922
{
"ccseq_importdate":"2017-06-05T04:00:00Z",
"ccseq_month":"1",
"ccseq_year":"2017",
"ccseq_name":"Test 30",
"ccseq_status":"100000000",
"ccseq_ccseq_expensetransactionset_ccseq_expensetransaction_ExpenseTransactionSetID":[
{
"ExpenseTransaction[ccseq_employeeid@odata.bind]":"/systemusers(6d2fd71b-32d1-dd11-a4f5-001a6449bbe7)",
"ExpenseTransaction[ccseq_clientid@odata.bind]":"/ccseq_clients(663ebd00-73b9-4faf-90ed-f56bb9c2dc9b)"
}
]
}
答案 0 :(得分:0)
将请求正文修改为:
{
"ccseq_importdate": "2017-06-05T04:00:00Z",
"ccseq_month": "1",
"ccseq_year": "2017",
"ccseq_name": "Test 30",
"ccseq_status": "100000000",
"ccseq_employeeid@odata.bind": "/systemusers(6d2fd71b-32d1-dd11-a4f5-001a6449bbe7)",
"ccseq_clientid@odata.bind": "/ccseq_clients(663ebd00-73b9-4faf-90ed-f56bb9c2dc9b)"
}