Lesson 9. How to get to real work

In this lesson, you will learn:

  1. How to get full access to the Yandex.Direct API
  2. What do I do if my request is approved but I didn't get the access.
  3. Request URLs​
  4. OAuth tokens for the app users
  5. Task
  6. What's next
  7. Useful links
  8. Questions

You have learned how to work with Yandex.Direct API, have practiced with campaign management in Sandbox, and, finally, after many hours of coding your first app is ready. So what do you need to ensure that your app can run not only in Sandbox, but also handle Yandex.Direct real user data?

How to get full access to the Yandex.Direct API

Since you have already registered your application with Yandex.OAuth, all you have to do is to apply for the full API access.

  1. Log in to Yandex with your developer username.
  2. Open Yandex.Direct web interface, go to API section, My requests tab.
  3. Convert the request for trial access into a full access request.


When filling out the request, please do not skip the Technical app info section. Make sure to specify accurate data there. In the Describe diagram of interaction between your app and Direct section, indicate your API interaction scenario. You do not need to attach your app code or the whole SOW with algorithms (these are your company's trade secrets, of course). It is sufficient to describe the services and Yandex.Direct API methods used by your app, the sequence of method invocation, and frequency of call for each method (every minute, every hour, etc.), and the purpose behind this frequency. Tell us how the application accounts for Yandex.Direct API limitations and handles errors. Based on this data we can see whether your app interacts correctly with the API and notify you of the API changes affecting your app.

What do I do if my request is approved but I didn't get the access.

If you get an error in response to your API request, check your request destination URL: probably, you are trying to access a wrong API version or wrong service. Make sure that you have obtained the token for the same Yandex.Direct user whose data the app is accessing.

Request URLs​

URLs for real advertising materials are different from the Sandbox URLs. Make sure to change URLs in the app:

  • For JSON requests — https://api.direct.yandex.com/json/v5/{service}
  • For SOAP requests — https://api.direct.yandex.com/v5 /{service}
  • A WSDL description is available at URL: https://api.direct.yandex.com/v5/{service}?wsdl

Here {service} is the name of the service you want to access.

Some methods from the previous Yandex.Direct API versions are available now also. URLs from previous versions differ from version 5 addresses.



OAuth tokens for the app users

In previous lessons, you used a debug token received manually in your API requests. Now you need to implement a mechanism allowing real users easily get the tokens. From the user perspective, obtaining a token should look as follows:

  1. The app opens an access request page of the Yandex.OAuth service.
  2. The user logs in to Yandex under their Yandex.Direct username (if logged off).
  3. On the access request page, the user clicks Allow.
  4. Depending on the app settings, Yandex.OAuth redirects the user to the URL set in the Callback URL parameter, or returns the user to the app.

Yandex.OAuth generates a token and transmits it to the application automatically. Yandex.OAuth supports multiple ways to transmit the token that are suitable for different types of apps: web services, desktop programs, mobile apps, etc. All methods are detailed in the Yandex.OAuth documentation.

Task

  1. Submit a request for full access to the Yandex.Direct API.
  2. Register a test Yandex.Direct user. For this new user, create an advertising campaign in the web interface and accept the user agreement in the API section.
  3. Get an OAuth token for the test user.
  4. Get real campaigns of the test user: make an API request on behalf of this user.

What's next

Now you know how to manage real ads using the Yandex.Direct API. In the next lesson, you will learn about the restriction system used in the API and see the recommended app interaction scenario.

Questions

  1. Your app is ready to work with the real data. How does the app get tokens for users now?
    False.
    False.
    True.
  2. What should you do to grant your app the full access to Yandex.Direct API instead of the test access?
    True.
    False.
    False.
  3. Which address must be used by the app to send requests for real data access?
    False.
    True.
    False.
    False.