LinqPad、odata 和 apikey url 参数

发布于 2024-09-27 14:14:30 字数 298 浏览 0 评论 0原文

我运行 OData API。为了控制使用,需要一个作为 url 参数附加的 apikey(我使用 这个答案)。我希望我的用户能够使用 LINQPad 探索 API 公开的数据。不幸的是,没有办法告诉 LINQPad 将 apikey 参数粘贴到查询 URL 的末尾。

对于如何解决这个问题有什么好的建议吗(我真的很想保留 apikey 系统)。

I run an OData API. To control usage, an apikey affixed as an url parameter is required (I use a variation of this answer). I'd love for my users to be able to explore the data exposed by the API using LINQPad. Ufortunately, there's no way to tell LINQPad to stick the apikey parameter to the end of query urls.

Are there any good suggestions for how to resolve this (and I'd really like to keep the apikey system).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

猥琐帝 2024-10-04 14:14:30

如果 api 密钥在标头中传递,您可以执行以下操作:

SendingRequest += (sender, args) => args.RequestHeaders.Add ("apikey", "foo");

Customers.Take(10).Dump();

但是,当 LINQPad 获取元数据时,这不会产生影响。如果您需要将 api 密钥附加到查询字符串(这似乎是您想要的),它也不会帮助您。

If the api key were passed in the headers, you could do this:

SendingRequest += (sender, args) => args.RequestHeaders.Add ("apikey", "foo");

Customers.Take(10).Dump();

However, this won't have an effect when LINQPad fetches metadata. It also won't help you if you need to append the api key to the query string (which seems to be what you want).

也只是曾经 2024-10-04 14:14:30
@LinqPad
Customers.AddQueryOption("apikey", "").Take(10)
@LinqPad
Customers.AddQueryOption("apikey", "").Take(10)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文