我正在尝试从外部应用程序中删除lightswitch数据库中的条目 我正在使用restsharp,代码如下所示:
var request = new RestRequest("/FilesSet/{Id}", Method.DELETE);
request.AddParameter("Id", 8);
var resp = client.Execute(request);
以下是完整的错误消息:
The request URI is not valid. Since the segment 'FilesSet' refers to a collection, this
must be the last segment in the request URI. All intermediate segments must refer to a
single resource.
答案 0 :(得分:0)
您似乎正在尝试查找实体并将其删除。在OData URL约定中,用于访问集合中实体的规范URL如下:
〜/ FilesSet({ID})
因此,您需要按如下方式修改代码:
var request = new RestRequest("/FilesSet({Id})", Method.DELETE);
request.AddParameter("Id", 8);
var resp = client.Execute(request);