Skip to content
This repository was archived by the owner on Nov 28, 2024. It is now read-only.

Creating YapiService instance

The-Smallest edited this page Feb 19, 2012 · 2 revisions

To use Yandex Direct API you should create instance of YapiService, all https communication is done inside it. YapiService should know path of your certificate and password. (If you don’t have pfx-certificate yet, read this). Creating YapiService instance could be done in several ways:

  1. Specifying path to certificate and password in constructor:
    var service = new YapiService("C:\\cert.pfx", "password");
  2. Passing YapiSettings instance to constructor:
    var settings = new YapiSettings("C:\\cert.pfx", "password") { Language = YapiLanguage.English }; 
    var service = new YapiService(setting);
  3. Adding special section to your exe’s configuration file:
    <configSections> 
      <section name="yandex.direct" type="Yandex.Direct.Configuration.YandexDirectSection, Yandex.Direct"/> 
    </configSections>
    <yandex.direct 
       certificatePath="C:\cert.pfx" 
       certificatePassword="password" 
       language="Russian" 
       masterToken=" " 
       login=" " />

Clone this wiki locally