我一直在尝试为我的 json 请求构建请求 url,但收到 404 错误。这是我在阅读了一些线程后放在一起的代码。任何人都可以帮忙吗?
var apiKey = "123456";
var Query = "some search";
var Location = "San Jose, CA";
var Sort = "1";
var SearchRadius = "100";
var values = HttpUtility.ParseQueryString(string.Empty);
values["k"] = apiKey;
values["q"] = Query;
values["l"] = Location;
values["sort"] = Sort;
values["radius"] = SearchRadius;
string url = "http://api.website.com/api" + values.toString();
这是我得到错误的地方。在 client.DownloadString() 上传递 url 后
var client = new WebClient();
var json = client.DownloadString(url);
var search = Json.Decode(json);