简体   繁体   English

Google Site Search C#API不返回任何促销

[英]Google Site Search C# API doesn't return any promotions

I am using google's "CustomSearch API Client Library for .NET" and trying to retrieve the promotions which I have created through the Control panel with the Add Promotion functionality. 我正在使用Google的“ .NET的CustomSearch API客户端库”,并尝试检索通过“控制面板”使用“添加促销”功能创建的促销。 I have a paid version of Google Site Search. 我有付费版的Google Site Search。

When I test it with the "Google Search"INSIDE the control panel it shows the promotion, but when I try to search through the .Net API, it returns Null in promotions. 当我在控制台内使用“ Google搜索”对其进行测试时,它会显示促销信息,但是当我尝试搜索.Net API时,它将在促销信息中返回Null。

I dont even get the promotions shown when I search with the API explorer. 当我使用API​​资源管理器进行搜索时,我什至没有得到显示的促销信息。 The promotion is active. 促销正在进行中。

Does it require some additional coding to get the promotions through the API? 是否需要一些额外的编码才能通过API获得促销?

Thank you.. 谢谢..

I found the answer. 我找到了答案。

The reason for why I wasn't getting any Promotion Results was because I had set the SiteSearch property to the domain. 之所以没有获得任何促销结果,是因为我已将SiteSearch属性设置为域。 When I removed the value from that property then it all worked :) 当我从该属性中删除该值时,它就全部起作用了:)

var listRequest = svc.Cse.List(query);
            listRequest.Hl = language;
            listRequest.Cx = this.cx;
            listRequest.Start = startIndex;
            listRequest.SiteSearch = "www.domain.name"; <-- this has to be removed

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM