Security & Authentication

Abstract

All DataX API calls must take place over HTTPS. Partner’s client implementations must validate Yahoo Ad Tech’s DataX server certificate prior to interacting with it.

Note

DataX does not support any clear-text API calls.

Get API Keys

Follow these steps to obtain your API Keys:

  1. Create a new project at: https://developer.yahooinc.com/apps/create/

    • Application Name: <a name>

    • Application Type: Web-based

    • Description: <a description>

    • Home Page URL: <though not relevant in this context, you can specify your homepage url.>

    • Access Scopes: This app will only access public APIs, Web Services

    • Premium API services: <leave unchecked>

  2. Save the following information from the next screen:

    • Application ID - displayed below your Application Name (an 8 character string, e.g., Qe78Z23f).

    • Consumer Key

    • Consumer Secret (keep secret!)

    You can change your consumer Secret at any time by visiting https://developer.yahooinc.com with the login credentials you used to create this Application. Once you are back at the Application screen that displays your Consumer Key & Consumer Secret, click “Save and Change Consumer Key” (toggle a permission to activate the button), to generate a new Consumer Secret.

  3. Be sure to work with your Yahoo Ad Tech contact to onboard the above Application ID on DataX as you (your partnership with Yahoo as a data provider). Internally, this Application ID will be used to identify you as a certain data provider/partner.

  4. Use your Consumer key and Consumer Secret in every call made to https://datax.yahooapis.com, via an Oauth library. Refer to Appendix A for examples.

Steps to Authenticate with Oauth

The example show below demonstrates how to use Oauth with PHP and call POST /taxonomy on datax.yahooapis.com.

Step 1: Create a taxonomy file and save as taxo.json (or change $post array to reflect your file name in the php code below).

Step 2: Download and save https://oauth.googlecode.com/svn/code/php/OAuth.php in the current directory.

Step 3: For v1 taxonomy API, create a php script with the following contents (replace $cc_key and $cc_secret with your credentials).

<?php
require("OAuth.php");
$cc_key = "Consumer Key goes here";
$cc_secret = "Secret Key goes here";
$url = "https://datax.yahooapis.com/v1/taxonomy";
$args = array();
$consumer = new OAuthConsumer($cc_key, $cc_secret);
$request = OAuthRequest::from_consumer_and_token($consumer, NULL,"POST", $url, $args);
$request->sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, NULL);
$url = sprintf("%s?%s", $url, OAuthUtil::build_http_query($args));
$ch = curl_init();
$headers = array($request->to_header());
print_r($headers);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$post=array("metadata"=>'{"description":"Description goes here"}',
"data"=>new CURLFile("Taxonomy JSON file")); curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$rsp = curl_exec($ch);
print($ch);
$results = json_decode($rsp); print_r($results);
?>

Step 4: $php <your_php.php>, returns a successful DataX Response. The following response is for v1.

{
        "resourceType":"datax-taxonomy",
        "resourceId": "130821T020855Z297392376",
        "description":"DataX Spec Sample", "createTime": "2013-08-21T02:08:55Z",
        "bytes": "423",
         "links": [
                {
                        "rel": "describes",
                        "href": "https://datax.yahooapis.com/v1/link/s/3b9mOUM9ffoqlWvH7OMakf0bk2vxg8z"
                },
                {
                        "rel": "self",
                        "href": "https://datax.yahooapis.com/v1/link/s/kPFlMKI9ffphJJf_p8_SszEz7mU"
                }
        ],
        "status": {
                "state": "PROCESSING",
                "lastUpdateTime": "2013-08-21T02:08:56Z"
        }
}

Step 5: Create a php script with the following contents to trigger self link (replace $cc_key anc $cc_secret with your credentials).

<?php require("OAuth.php");
$cc_key   = "your consumer key here";
$cc_secret = "your consumer secret here";
$url="the self link url here";
$args = array();
$consumer = new OAuthConsumer($cc_key, $cc_secret);
$request = OAuthRequest::from_consumer_and_token($consumer, NULL,"GET", $url, $args);
$request->sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, NULL);
$url = sprintf("%s?%s", $url, OAuthUtil::build_http_query($args));
$ch = curl_init();
$headers = array($request->to_header());
curl_setopt($ch, CURLOPT_HTTPHEADER,
$headers); curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
curl_setopt($ch, CURLOPT_POST, FALSE);
$rsp = curl_exec($ch);
$results = json_decode($rsp); print_r($results);
?>

Navigate to this link for Oauth coding examples in PHP, Perl, Ruby, C#, Java and Node.JS:

https://developer.yahoo.com/boss/search/boss_api_guide/codeexamples.html

Important

The Yahoo Ad Tech Boss API is not related to DataX. Use this link only as a starting point. We are currently working on making native DataX examples available in the above languages as well. Check with your Yahoo Ad Tech contact for the status of examples in your language of integration.