› Test

Small example for the usage of the SeedFinder JSON API

This is a small example for real, but it will show you how you can use our API to create own applications for your website. For this example we use bothe APIs, the one for the the IDs and the StrainInfo-Api.

OK, here we go...

  • 1.: Our example will get at first the Breeder/Strain-ID JSON with a <script> tag in the header of the page. This will result (because of the parameter &output=1 in the url) in a Javascript-Object called BREEDER.
  • 2.: Out of this object we can generate very easily our small select-boxes for the breeders and strains. For this we have added the functions selectbreederform() and selectseedform().
  • 3.: If a strain was selected, the function loadStrainInfo() will be called and get the info with the help of jQuery's $.ajax() function from the SeedFinder StrainInfo-Api. As you see its with the JSONP-extension, so it also will work cross-domain. The function also parse the given data and will output the name, the breeders name and the description directly into the html-page.
  • Thats all, here the live-example - below you will find the code to test byself.

Test it right now:

Lets test

Click here to show a formular for breeders, then select a strain and read in the actual info!

The code for the example:

In the header:

The folloing code have to be stored in the header between <head> and </head>

<script src="jquery.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript" src="http://en.seedfinder.eu/api/json/ids.json?output=1&strains=1"></script>

In the body:

The folloing code can be pasted somewhere onto the page between <body> and </body>

<script type="text/javascript">
function loadStrainInfo() {
   document.getElementById('TestTitle').innerHTML = '...please wait while loading';
   document.getElementById('TestDescr').innerHTML = '';
   var br = document.getElementById('breeder').value;
   var str = document.getElementById('strains').value;
   var thedata = 'br=' + br + '&str=' + str + '&output=2';
    dataType: 'jsonp',
    jsonp: 'jsonp_callback',
    url: 'http://en.seedfinder.eu/api/json/strain.json',
    data: thedata,
    success: function (STRAIN) {
      $('.TestTitle').html(STRAIN.name + ' (from ' + STRAIN.brinfo.name + ')');

function selectseedform() {
   document.getElementById('TestTitle').innerHTML = '';
   document.getElementById('TestDescr').innerHTML = '';
   var thebreeder = document.getElementById('breeder').value;
   var strainselect = '<select id="strains" name="strains" size="1" onChange="loadStrainInfo();">\n   <option value="nix" id="nix" name="nix" selected="selected">...select a strain</option>';
   for(var bree in BREEDER) {
      if(bree == thebreeder) {
         for(var strainid in BREEDER[bree].strains) {
            strainselect = strainselect + '\n   <option value="' + strainid + '" id="' + strainid + '" name="' + strainid + '">' + BREEDER[bree].strains[strainid] + '</option>';
   document.getElementById('strainp').innerHTML = strainselect + '</select>';

function selectbreederform() {
   var breeselect = '<select id="breeder" name="breeder" size="1" onChange="selectseedform();">\n   <option value="nix" id="nix" name="nix" selected="selected">please select a breeder</option>';
   for(var bree in BREEDER) {
      breeselect = breeselect + '\n   <option value="' + bree + '" id="' + bree + '" name="' + bree + '">' + BREEDER[bree].name + '</option>';
   document.getElementById('breederp').innerHTML = breeselect + '</select>';

   <span id="breederp"></span>
   <span id="strainp"></span>
<h1 id="TestTitle" class="TestTitle">Lets test</h1>
<p id="TestDescr" class="TestDescr"><a href="javascript:selectbreederform();" title="test">Click here</a> to show a formular for breeders, then select a strain and read in the actual info!</p>


Please note:
To use our JSON API you must verify your domain(s) here into the User-Area at first!

If you do a request from a unregistered domain you will get an Error 403!

Creative Commons BY-NC-SA 3.0 License With the help of the SeedFinder API you will be able to use our data for your own applications, widgets and integrate our info directly into your homepage. Use of the API is completely free if you follow the license terms. To stay informed about the API please connect an email to your user-account (so we can contact you if there are questions) and/or drop an eye to our Newsflash! If you don't like add backlinks or if you're running a commercial site, please contact us before using our api. »» All content is licensed under a Creative Commons BY-NC-SA 3.0 License