Foursquare API的400错误请求[英] 400 Bad Request with Foursquare API

本文是小编为大家收集整理的关于Foursquare API的400错误请求的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我正在向4SQ发布一次检查,但请继续获得400个不良要求.这是一个非常简单的代码,可以进行检查:

client = new WebClient();
client.UploadStringCompleted += (s, args) =>
{
    var result = args.Result;
};
client.UploadStringAsync(new Uri("https://api.foursquare.com/v2/checkins/add/?oauth_token=my_token"),
"POST", "venueId=venue_id");

我确定my_token和venue_id是正确的,因为我使用它们来获取以前的checkins和contue信息列表.

您看到此代码有问题吗?

谢谢.

推荐答案

将OAuth_Token指定为帖子参数,而不是URL路径的一部分.

其他推荐答案

您缺少"广播"参数.它按要求列出:

/a>

本文地址:https://www.itbaoku.cn/post/2090880.html

问题描述

I am posting a checkin to 4sq but keep getting 400 Bad Request. Here is a very simple code that does the checkin:

client = new WebClient();
client.UploadStringCompleted += (s, args) =>
{
    var result = args.Result;
};
client.UploadStringAsync(new Uri("https://api.foursquare.com/v2/checkins/add/?oauth_token=my_token"),
"POST", "venueId=venue_id");

I am sure my_token and venue_id is correct because I use them for getting list of previous checkins and venue information.

Do you see something wrong with this code?

Thanks.

推荐答案

Specify the oauth_token as a POST param, not part of the URL path.

其他推荐答案

You're missing the 'broadcast' parameter. It's listed as required:

https://developer.foursquare.com/docs/checkins/add.html