To simplify the work with the ReportingAPI REST API, the SDK contains a simple URL generator and a simple REST client. You can use it to generate, sign URLs with provided parameters and interact with the API. You have to create an instance from the ReportingApiUrlGenerator and from the ReportingApiClient classes. The library using RequestObjects to handle request parameters. You can create a parameter objects (RequestObjects), set the properties on it and use the same object for signing and for data retriveal.

  • Instantiating the ReportingApiUrlGenerator class

    var reportingApiUrlGenerator = new ReportingApiUrlGenerator(
  • Get a signed URL for an action

    var getEmotionAllDataUri = reportingApiUrlGenerator.GetSignedUrl(
      new GetEmotionAllDataRequest { StudyId = 537, MediaId = 2515 });
  • The default expiration for the signed URLs is 1 hour. You can use the DefaultSignatureExpiration property on the ReportingApiUrlGenerator to change it.

    reportingApiUrlGenerator.DefaultSignatureExpiration = TimeSpan.FromHours(2);
  • If you don’t set the Expiration for the Request, it will be the DefaultSignatureExpiration from the reportingApiUrlGenerator. If you want to override it, set the Expiration on the request object.

    var request = new GetEmotionAllDataRequest
                              StudyId = 537,
                              MediaId = 2515,
                              Expiration = TimeSpan.FromHours(2)
    var getEmotionAllDataUri = reportingApiUrlGenerator.GetSignedUrl(request);
  • If you don’t set the HttpMethod for the request, it will be GET by default. To get a signed URL for a POST request, set the HttpMethod on the request object.

    var request = new GetChartDataRequest(537, 2515);
    request.HttpMethod = HttpMethod.Post;                     
    var getChartDataUri = reportingApiUrlGenerator.GetSignedUrl(request);
    * It is really important, if the Url is signed as a GET request,
    * you can not use it for POST requests.
    * And it is true in the other way around as well.
    * Also pay attention, that the Url-s Expiring, so there is a limit,
    * how long can the Url-s be reused!
  • Alternative way to sign an URL, to build it up yourself and use just the Signature calculation from the ReportingApiUrlGenerator.

    var url = "http://reportingapi.realeyesit.com/api/v1/GetEmotionAllData?studyId=537&mediaId=2515&AccessKey=3c2819e2026d6168&Expiration=1408363235";
    var signature = reportingApiUrlGenerator.GetSignature(url);
    var signedUrl = string.Format("{0}&Signature={1}", url, signature);
  • Instantiating the ReportingApiClient class

    var reportingApiClient = new ReportingApiClient(reportingApiUrlGenerator);
  • To interact with the REST Api, call the methods on the ReportingApiClient class

    //Get studies
    var studies = reportingApiClient.GetStudies();
    //Get media list by name
    var mediaListByName = reportingApiClient.GetMediaListByName(
    new GetMediaListByNameRequest { MediaName = "BT " });