Developer / Documentation / How to create an application?

These tutorials describe working with the custom Netlog REST API we offer next to our OpenSocial implementation. If you'd like to use this API, please get in touch first.

Introduction

This tutorial describes how brands can add applications to their profile. This option is only available for trusted brands. To become a trusted brand, you need to file a request directly to Netlog.

Brand applications

Brand applications are typically used for adding an application to your brand profile page and will only be available on that brand profile. It does not behave like a 'normal' application which is addable by users. Therefor, once you have acquired your application ID and application Key, you need to file a request to Netlog to convert your application to a brand application.

Integration

Once you are a trusted brand and you have purchased your application ID and application Key for a brand application, you can build your application (see tutorial).
When your application is ready, you can add it on your brand page using the header, footer or sidebar.
As a trusted brand, you can put custom HTML in one of these places.
To enable that block for an application, put the following code as the first line of your custom HTML:

<netlog appid="YourAppID" />

Now you can put the HTML code that makes up the application.
Typically, this can be an iframe with a URL to your application page:

<iframe src="http://www.mywebsite.com/myApplication/"></iframe>

However, when running an application, that application needs a ticket, API server and language (see the Authentication Guide). For an application to obtain this data, generally it needs to redirect the user to our user API login page. However, when running a brand application on a brand profile, a user is already logged in.
Therefor, we can already provide the brand application with these three parameters. In order to pass these parameters, we provide three variables that you can put in your custom HTML code:

{netlogticket}
will be replaced by the ticket needed by your application
{netlogapiserver}
will be replaced by the API server needed by your application (urlencoded)
{netloglanguage}
will be replaced with the language of Netlog the user is surfing on

As a brand application it could also be useful to use specific parameters that are passed on to your application page. For this matter, we also provide the functionality to pass on GET variables from Netlog to your application page.
For example, when the url is http://en.netlog.com/yourbrand/playlist=1&name=jos you can pass the playlist=1&temp=5 on to your application using:

{netlogget}
will be replaced by all GET variables.

When you want to use a single GET variable somewhere, you can use it by placing it between two accodances. For example, if you want to use the value of playlist, you can use {playlist} anywhere in your script

For example, when surfing to http://en.netlog.com/yourbrand/playlist=1&name=jos, the following data will be available:
  • {netlogget}: playlist=1&name=jos
  • {playlist}: 1
  • {name}: jos

Remarks:
  • At Netlog, we don't use the leading '?' for the use of GET variables so you should use http://en.netlog.com/yourbrand/playlist=1&name=jos instead of http://en.netlog.com/yourbrand/?playlist=1&name=jos
  • When a certain GET variable is not set, we will return an empty string
  • Following GET variables are not allowed and will result in an empty string: module, submodule, nickname
  • Following variables are allowed, but will be overwritten with the value as described above: netlogticket, netlogapiserver, netloglanguage, netlogget

Putting the pieces together, your custom HTML can be, for example, something like this:

<netlog appid="YourAppID" />
<iframe src="http://www.mywebsite.com/myApplication/?ticket={netlogticket}&apiServer={netlogapiserver}&language={netloglanguage}&{netlogget}"></iframe>

Normally, users add applications to their Netlog account before they can use these applications. Therefor, he will always be logged in to use an application.
However, brand applications differ from this concept as they are not addable by users and it will only be accessible trough the brand profile. As that profile can also be accessed by users that are not logged in, it is impossible to create a ticket for that user. If this is the case, we will replace the {netlogticket} variable by noLoggedInUser. When creating your brand application, you need to check for this value and act accordingly.
For example, when there is no logged in user, you could show an image representing your application which suggests the user to log in.