开发者

LinqPad, odata and apikey url-parameter

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 li开发者_运维问答ke to keep the apikey system).


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).


@LinqPad
Customers.AddQueryOption("apikey", "").Take(10)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜