Hyves - Always in touch with your friends

Data-API

Methods

On Hyves we use several tags to control the markup of scraps, status updates, smileys and more. These tags work fine on Hyves, but we can imagine that if you use the API to display data from Hyves on your own website or application, you don't need or want these tags.

To transform these tags to proper HTML-formatted strings you can use FancyLayout.

Using Fancy Layout

You can use FancyLayout for the following items:

  • Text markup; display bold, italic and strike-through text
  • Display of media (image or video) from Hyves. It's not possible to use media from external websites
  • Display of links to Hyvers, Hubs, internal and external webpages
  • Display Gadgets or embed video's from YouTube
  • Display smileys

In the Hyves API, you have two ways to work with Fancy Layout:

  • Adding the global parameter ha_fancylayout=true to your API call.
  • Use the method fancylayout.parse.
Using ha_fancylayout

If you add the global parameter ha_fancylayout=true to your API call it will return all the fancy layout enabled return values in the correct formatting.

A simple API call with fancy layout will look like the following:

http://data.hyves-api.nl/?ha_fancylayout=true&ha_format=xml&ha_method=wwws.getByUser&ha_version=2.0&oauth_consumer_key=NjExMV8n1q7aieIEiflj0higiQGb&oauth_nonce=&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1274277612&oauth_token=YXRfMTU4OTk0MTIyX5nQ_zjW6b8oTEpPV6tTMPY%3D&oauth_version=1.0&userid=6c7ec0b62fca4e5f&oauth_signature=5xHAXh5j4Th5%2Bh9GAfrrOpk%2FXCQ%3D

This will return the following result:

<?xml version="1.0" encoding="UTF-8"?>
<wwws_getByUser_result>
        <www>
                <wwwid>00672dbd55bc2198017f17ec1faa5ed5be</wwwid>
                <emotion><em>eating</em> a <strong>banana</strong> <img src="http://cache.hyves-static.net/images/smilies/default/smiley_groot.gif" alt=":-d" title=":-d" border="0" /> </emotion>
                <where>the forest</where>
                <url>http://gorillaapi.hyves.nl/wiewatwaar/238881236/j_IA/</url>
                <userid>00cc68f39949140377bebf54013a15f63f</userid>
                <visibility>superpublic</visibility>
                <created>1274277880</created>
        </www>
        <info>
                <timestamp_difference>10</timestamp_difference>
                <totalresults>1</totalresults>
                <totalpages>1</totalpages>
                <resultsperpage>12</resultsperpage>
                <currentpage>1</currentpage>
                <running_milliseconds>112</running_milliseconds>
                <secure_connection>false</secure_connection>
        </info>
</wwws_getByUser_result>

As you can see the emotion field now contains proper formatted HTML instead of the tags used on Hyves.

Using fancylayout.parse

You can use the method fancylayout.parse to convert a string with specific Hyves tags to a proper HTML-formatted string. The method has 2 parameters:

  • string - The string you want to convert. This will be the string with tags. For this example we'll use this string:

<strong>This</strong> <em>is a</em> string :)

  • fancylayouttype - You can use this parameter to skip specific elements from being fancy layout'ed. Possible values are:
  • search
  • body
  • oneliner
  • breadcrumb
  • link
  • title
  • gadgettitle
  • cleanhyvers
  • nickname
  • naturalname
  • edit
  • escape
  • hyver
  • amazon
  • flashname
  • url
  • blog
  • plaintext

The API call for this will look the following:

http://data.hyves-api.nl/?ha_fancylayout=false&ha_format=xml&ha_method=fancylayout.parse&ha_version=2.0&oauth_consumer_key=NjExMV8n1q7aieIEiflj0higiQGb&oauth_nonce=&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1274281918&oauth_token=YXRfMTU5MDA5Mzg1X5oQzTWK-7FfcBfqL8TIRDA%3D&oauth_version=1.0&string=%5Bb%5DThis%5B%2Fb%5D%5Bi%5Dis%20a%5B%2Fi%5D%5Bstrike%5Dstring%5B%2Fstrike%5D%20%3A%29&oauth_signature=NeIllvHxOYYk9eUtPIt%2Flovtl%2Fs%3D

Note: The string must be properly url encoded

This will return the following result:

<?xml version="1.0" encoding="UTF-8"?>
<fancylayout_parse_result>
        <fl_string>
                <strong>This</strong><em>is a</em><span style="text-decoration: line-through;">string</span> <img src="http://cache.hyves-static.net/images/smilies/default/smiley_lach.gif" alt=":-)" title=":-)" border="0" /> 
        </fl_string>
        <info>
                <timestamp_difference>11</timestamp_difference>
                <running_milliseconds>105</running_milliseconds>
                <secure_connection>false</secure_connection>
        </info>
</fancylayout_parse_result>

For more information, see fancylayout.parse.

Supported tags
[b][ /b] Used to display bold text
[i][ /i] Used to display italic text
[strike][ /strike] Used to display strike-through text
[media id=MEDIAID size=small] Used to display a media item from Hyves (image or video) where MEDIAID is the ID of the actual media item and size is the displayed size which can be: small, medium, large or xlarge.
[hyver=USERNAME]NAME[ /hyver] Used to display a link to a specific Hyver where USERNAME is the username of a specific Hyver and DISPLAYNAME is the name that will be displayed as a link (e.g. [hyver=gorillaapi]Gorilla[ /hyver]).
[url=URL]DISPLAY LINK[ /url] Used to display a link on hyves where URL is the actual url and DISPLAY LINK is the variable which will be displayed.
[gadget][ /gadget] Used to display a embed code such as YouTube video’s and OpenSocial Gadgets.
:-) or :-( or ;-) Used to display smileys. You can use users.getSmileys to get an overview of all available smileys.
Return values

Fancylayout is supported by the following list of return values:

  • aboutme
  • body
  • cityname
  • countryname
  • description
  • displaybody
  • document
  • emotion
  • firstname
  • lastname
  • name
  • nickname
  • onmymind
  • subject
  • title
  • video
  • where
  • whitespacekey
  • whitespacevalue

© 2004-2012 Hyves   Algemene Gebruiksvoorwaarden   Je Privacy

Aanmelden