我正在尝试使用MQLWrite写信给 Freebase 。我设法使用 Freebase Query 进行编写。我输入网址并收到一条错误消息
需要登录
我正在使用 C#。
另一件事是我不需要用户同意。我在 Google Developer 控制台中创建了一个服务帐户,并尝试使用此 url 中的以下代码:
public class Program
{
// A known public activity.
private static String ACTIVITY_ID = "z12gtjhq3qn2xxl2o224exwiqruvtda0i";
public static void Main(string[] args)
{
Console.WriteLine("Plus API - Service Account");
Console.WriteLine("==========================");
String serviceAccountEmail = "SERVICE_ACCOUNT_EMAIL_HERE";
var certificate = new X509Certificate2(@"key.p12", "notasecret", X509KeyStorageFlags.Exportable);
ServiceAccountCredential credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(serviceAccountEmail)
{
Scopes = new[] { PlusService.Scope.PlusMe }
}.FromCertificate(certificate));
// Create the service.
var service = new PlusService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Plus API Sample",
});
Activity activity = service.Activities.Get(ACTIVITY_ID).Execute();
Console.WriteLine(" Activity: " + activity.Object.Content);
Console.WriteLine(" Video: " + activity.Object.Attachments[0].Url);
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
}
}
- 我不知道 ACTIVITY_ID 是什么意思,和 CLIENT_ID 一样吗?
- 在上面的示例中,他们使用 plus,但我想使用 Freebase,并且在命名空间中的任何位置都找不到 scope 属性。感谢任何帮助... :)