Demandbase Connect

facterylabs / FactSource API Meta
View
 

FactSource API Meta

Page history last edited by christina.cece@gmail.com 8 mos ago

<- Back to Factery API Documentation

 

See an example of our FactSource API in action here.

 

meta

Returns Factery metadata for a given URL set.  Clients of this API can submit Twitter updates as the URL set.  The FactEngine will resolve any shortened URLs, dynamically create an index of all facts mined from the target pages of the URLs, and return the facts relevant to the submitted query.  You'll be able to see which facts are useful, and which URLs we've identified as spam or porn.

 

URL:

    http://factfindersource.facterylabs.com/

 

Formats:

    atom/xml (json coming soon)

 

HTTP Method:

    POST

 

Post Input:

  • q: Optional. query term
  • t: Optional.  Timeout.  maximum accepted delay waiting for a non-cached external page.
  • callback: Optional.  The default reqtype is xml (json, coming soon)
  • reqtype: Optional.  The default reqtype is xml (json, coming soon)
  • postdata:  Required.  Postdata should be the atom xml part of the request.
  • n:  Required.  Limit the factset size returned per Twitter update.  Default is 10

 

Usage Notes:

  • If both the query and URL set are empty, this function will return nothing.  If the query is empty and urlset is non-empty, then the API will return all of the facts.  If the query is non-empty and the urlset is empty, then FactSource will extract facts from a default url source, such as Yahoo Boss.
  • maxiumum number of urls to pass in is 50
  • maximum facts returned per url is 10

 

Example Post Input:

<entry> 

  <id>4449124810</id> 

  <content type="html">#MusicMonday  #LamaRoDoM  Jay-Z yom Kippur Philippines Frankie H1N1 http://tinyurl.com/n86mkw </content> 

  <author> 

    <name>(Hula Debi)</name> 

  </author> 

  <fc:metadata> 

    <fc:meta key="time-since"> (about 0 minutes ago)</fc:meta> 

  </fc:metadata> 

</entry> 

<entry> 

  <id>4449124805</id> 

  <content type="html">окаy wасhing Distriсt 9 моvie Here http://cli.gs/P8PTtm   iPL H1N1 ACORN</content> 

  <author> 

    <name>(Anna Capelsad)</name> 

  </author> 

  <fc:metadata> 

    <fc:meta key="time-since"> (about 0 minutes ago)</fc:meta> 

  </fc:metadata> 

</entry> 

<entry> 

  <id>4449122251</id> 

  <content type="html">If yоu hаvеn't sееn nеw yеt hеrе http://ur.ly/35tB   '"Roman Polanski" OR Polanski' H1N1 Cadel Evans</content> 

  <author> 

    <name>(Anna Reeseipi)</name> 

  </author> 

  <fc:metadata> 

    <fc:meta key="time-since"> (about 0 minutes ago)</fc:meta> 

  </fc:metadata> 

</entry>

 

Response:

                We get back expanded Twitter atom/xml in the form:

<entries xmlns:fc="http://www.factery.net/apis/twitter-fact/">

  <entry>

    <id>4449377125</id>

    <published></published>

    <link type="text/html" rel="alternate" href="http://twitter.com/(Anna/statuses/4449377125"/>

    <title></title>

    <updated></updated>

    <link type="" href=""/>

    <content type="html">x%D0%B0hh+u%D1%81%D0%B0n+w%D0%B0t%D1%81h%C2%A7Distri%D1%81t+9%C2%A7+movi%D0%B5+h%D0%B5r%D0%B5+http://u.nu/5mbc3++%23musicmonday++H1N1+Megan+Fox</content>

    <author>

      <name>(Anna Johnsonxwv)</name>

      <uri></uri>

    </author>

    <fc:metadata>

      <fc:meta key="time-since">(about 2 minutes ago)</fc:meta>

      <fc:meta key="url">http://images.google.com/imgres?imgurl=http://banglamovies.com/bm-images/movie-pictures/monpura-bangla-movie/bangla-movie-monpura-farhana-mili.jpg&imgrefurl=http://r4j.eu/g1/?nnpcqccanvnpetstvqz&usg=__o5vm98vdubdefchsiodiq8suy44=&h=402&w=604&sz=36&hl=en&start=417&tbnid=oaqdyotn3nhl9m:&tbnh=90&tbnw=135&prev=/images%3fq%3dmovie%26gbv%3d1%26hl%3den%26sa%3dn%26start%3d398 </fc:meta>

      <fc:meta key="shorturl">http://u.nu/5mbc3</fc:meta>

      <fc:meta key="site">images.google.com</fc:meta>

      <fc:meta key="extract-count">0</fc:meta>

      <fc:meta key="factrank">8%</fc:meta>

    </fc:metadata>

    <fc:return returncode="600">non-English page detected</fc:return>

  </entry>

  <entry>

    <id>4449372704</id>

    <published></published>

    <link type="text/html" rel="alternate" href="http://twitter.com/(Shuka/statuses/4449372704"/>

    <title></title>

    <updated></updated>

    <link type="" href=""/>

    <content type="html">RT+@iHealthBeat+:+Federal+Government+Steps+Up+H1N1+Flu+Tracking+Efforts+-+http://bit.ly/FkW41++%23+H1N1++%23swineflu</content>

    <author>

      <name>(Shuka Kalantari)</name>

      <uri></uri>

    </author>

    <fc:metadata>

      <fc:meta key="time-since">(about 2 minutes ago)</fc:meta>

      <fc:meta key="url">http://www.ihealthbeat.org/Articles/2009/9/28/Federal-Government-Steps-Up-H1N1-Flu-Tracking-Efforts.aspx </fc:meta>

      <fc:meta key="shorturl">http://bit.ly/FkW41</fc:meta>

      <fc:meta key="site">ihealthbeat.org</fc:meta>

      <fc:meta key="extract-count">13</fc:meta>

      <fc:meta key="factrank">80%</fc:meta>

    </fc:metadata>

    <fc:return returncode="200"></fc:return>

    <fc:extracts id="4449372704">

      <fc:item>

        <fc:titles>Federal Government Steps Up H1N1 Flu Tracking Efforts - iHealthBeat >> FROM THE FOUNDATION >> The Social Life of Health Information</fc:titles>

        <fc:content>A new Pew Internet/CHCF national survey finds the Internet has joined doctors and family members as one of the top three ways people search for answer to their health care questions.</fc:content>

      </fc:item>

      <fc:item>

        <fc:titles>Federal Government Steps Up H1N1 Flu Tracking Efforts - iHealthBeat >> FROM THE FOUNDATION >> The Social Life of Health Information</fc:titles>

        <fc:content>In addition to routine vaccine tracking, the government is sponsoring several new projects to monitor potential side effects.</fc:content>

      </fc:item>

      <fc:item>

        <fc:titles>Federal Government Steps Up H1N1 Flu Tracking Efforts - iHealthBeat >> FROM THE FOUNDATION >> The Social Life of Health Information</fc:titles>

        <fc:content>The federal government has launched several new H1N1 flu vaccination tracking efforts designed to identify potential side effects, the AP/Long Island Newsday reports.</fc:content>

      </fc:item>

      <fc:item>

        <fc:titles>Federal Government Steps Up H1N1 Flu Tracking Efforts - iHealthBeat >> FROM THE FOUNDATION >> The Social Life of Health Information</fc:titles>

        <fc:content>The state health departments electronically collect patient-level flu information from emergency departments and physicians.</fc:content>

      </fc:item>

      <fc:item>

        <fc:titles>Federal Government Steps Up H1N1 Flu Tracking Efforts - iHealthBeat >> FROM THE FOUNDATION >> The Social Life of Health Information</fc:titles>

        <fc:content>For example, Harvard Medical School scientists are linking large insurance databases that include information on as many as 50 million people with vaccination registries nationwide to track in real time if and why patients visit a doctor in the weeks after receiving an H1N1 flu vaccination.</fc:content>

      </fc:item>

      <fc:item>

        <fc:titles>Federal Government Steps Up H1N1 Flu Tracking Efforts - iHealthBeat >> FROM THE FOUNDATION >> Dental Services, EHRs, and the Stimulus Bill</fc:titles>

        <fc:content>The recently enacted economic stimulus legislation includes funding to help oral health providers adopt EHRs, as well as improve patients' access to care.</fc:content>

      </fc:item>

    </fc:extracts>

  </entry>

</entries>


Notes:

    There are three new groups of data added to the standard Twitter atom/xml:

    (1) fc:metadata

        This is a list of metadata key-value pairs encoded as:

         <fc:meta key="KEY ">VALUE</fc:meta>

         Keys can be one of the following:

  • shorturl- the shortened url contained within the tweet
  • url- the resolved short URL
  • extract-count- the number of matched results on the page
  • score- the Factery quality ranking of the result.  A score close to 0 indicates a higher quality result

 

    (2) fc:extracts

        This is a list of relevant facts extracted from the target page encoded as:

          <fc:item>

            <fc:titles>..</fc:titles>

            <fc:content>..</fc:content>

          </fc:item>

 

        The fc:titles element value is a chain of enclosing titles separated by " >> ", ordered

        left to right as

          anchor >> doc title >> title >> sub-title >> ..

 

    (3) fc:return

        This is the factery return code for the metadata request, encoded as:

          <fc:return returncode="CODE">ERRMSG</fc:return >

 

Example PHP code:

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://sobees.facterylabs.com?q=".$query0."&t=60&callback=xml");

    $header  =  array( "Content-type: application/x-www-form-urlencoded" );

    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

    curl_setopt($ch, CURLOPT_POST,1);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt ($ch, CURLOPT_POSTFIELDS, "content=".$encodedpostdata);

    $server_output = curl_exec($ch);

Comments (0)

You don't have permission to comment on this page.