Tag Archive for php

Forrst PHP API Wrapper

forrstbig

A while back, I had written up an API wrapper to go along with the new Forrst API that had just been released. I had hoped that it would benefit someone that may need to use the Forrst API in developing an application or website.

To begin, you can download the source by visiting the GitHub page, and choosing to download the master branch. This will give you everything you need to start with.

First, we’ll start by making sure the wrapper is included with your application or script.

Now, we’ll move on to actually instantiating the class

From here, we can do a number of things, such as grabbing user information or checking our notifications. However, for some of the API features, we need to authenticate ourselves. Let’s do that now.

Since this is a quick and dirty example, we won’t be storing our token. In a production environment, you would want to store this token in a cookie or in a database in order to save on API calls. Since this token never changes or expires, it is OK to store it permanently.

OK, so we got that out of the way. We want to get any unread notifications we may have. We’ll start by passing our token variable we retrieved above, and passing it to the function.

To get a better understanding of what will be returned, see the documentation on Forrst.com as well as GitHub.com.