Monitor API Tutorial, Part 2: A Simple Client

This is a basic tutorial series for using the Gavagai Monitor API v2

Creating a Simple Client

Let's start to create a simple client that actually does something. The first step is to find some target of interest. Then, in the next two parts of this tutorial series we will get some sentiment readings and finally trace the underlying documents. 

  1. Assuming that you have already worked through the first part of this tutorial series, you will have a username, password, and api key handy. If not please go back and complete that part first.
  2. Now we will make a call to the API to see if there are any interesting targets to look at. In Monitor API, a target is the same as something that you are interested in following in the ocean of information that is constantly being published to the Internet. It could be a person, or an event, or a brand name or whatever you like. Perhaps you are interested in politics and would like to examine a political party?

  3. Have a look at the API documentation under the observers section. Here is a link. In the next step you will need to reference this documentation.

  4. To get a list of publicly available targets (or observers as they are also called) you will use the following resource:

    /observers 

    This is the convention for specifying calls that we will use throughout this tutorial. The code block above shows you how to make the call in its simplest form. Since nothing else is specified we assume that this is a regular HTTP GET call (the kind you can easily try out in your browser). Now look at the documentation page and find this call (it's the first one). Read the documentation. As you can see there are some optional parameters that we could specify but we will keep it simple so we won't.

  5. Now perform the call using your own credentials (username, password, and apiKey). The call should look something like this

     https://ethersource.gavagai.se/ethersource/rest/v2/observers?apiKey=someKey


    If everything works you will get a response containing some JSON data that looks similar to the examples in the documentation (for an observerDetailsList). Actual returned data might look like this (this is just a part of it):

    • {
      • id6082,
      • name"stockholm",
      • created"2014-02-20 10:43:35 CET",
      • kpiId0,
      • description"",
      • targetTerms: [
        • "stockholm",
        • "stockholmarna",
        • "stockholms",
        • "stockholmare"
        ],
      • language"SV",
      • editabletrue
      },
  6. If your returned JSON data is not as pretty as mine you may wish to install a JSON view extension to Chrome. JSONView works.
  7. Now pick an observer that you like. The important part is the id. Make a note of it (or you could even save the whole JSON). You will need it in a later part of this tutorial series.

You have now completed the second step of the Monitor API Basic Tutorial Series. 

Next Steps