New developer needs a little help!

  • 2
  • Question
  • Updated 2 years ago
  • Answered
Archived and Closed

This conversation is no longer open for comments or replies and is no longer visible to community members.

A client is using their displays to show room reservations and active events.  They to be able to use their displays to show adverts and promotional material when the rooms are not in use.

The reservation system is custom-made, and sadly the Google Calendar approach won't work for them.

From what I can see, there is no way of choosing a presentation based on a condition; all schedules are either 'always', or timed, and since these reservations are not fixed in length, date, etc.

Unless someone has better ideas, it seems that I will need to integrate the API in to my application to be able to change the presentation in use dynamically.

So far, I've managed to set up an application, and created an API key with Google.  I also have cloned the api-core git repository.  Although not specified in the instructions, I've changed the Client ID in auth.js to match the one I've generated (the default gave an origin_mismatch error).

So, from what I can see I am signed in.  However, if I try any of the routines, I'm out of luck; as some of the source is not secure, Chrome will not run it.



If I enable insecure scripts, I get the spinner, but I also get this error:



...and at this point, I'm a little lost!  The Developer console is showing that no requests have been received, but I cannot trace why.

Can anyone help out here?  I'm guessing I'm missing something fairly elementary!
Photo of Kevin Beeley

Kevin Beeley

  • 140 Points 100 badge 2x thumb

Posted 2 years ago

  • 2
Photo of Ezequiel Conte

Ezequiel Conte, Employee

  • 874 Points 500 badge 2x thumb
Hi Kevin,

I investigated your issue and I was able to replicate it.
In my case, the issue happened because I was hitting our Test servers.
To fix it, make sure ROOT variable (https://github.com/Rise-Vision/core-api/blob/gh-pages/javascript/auth.js#L26) points to our production server https://rvaserver2.appspot.com/_ah/api

Also, don't forget to register your App and Client ID at https://developer.risevision.com, otherwise you will get "User is not authenticated" errors.

Let me know if that helps.
Cheers!

P.S.: If you run your server on HTTP instead of HTTPS, you will not have the Spinner issue.
Photo of Kevin Beeley

Kevin Beeley

  • 140 Points 100 badge 2x thumb
Ezequiel, that did it - have managed to get down, test, and do a schedule modify, so thank you!  If I wish to incorporate the API in to my own application, is there a standard library I can use to do so, or am I going to have to bodge it together?
Photo of Ezequiel Conte

Ezequiel Conte, Employee

  • 874 Points 500 badge 2x thumb
Hi Kevin,  good to hear that!

We don't have a specific library, but as you can see in the core-api code, the requests are based on Google Javascript Client API, then you can access them as objects:


gapi.client.load(API_NAME, API_VER, function () {  
        var request = gapi.client.core.company.get(parameters);
...

Cheers!
Photo of Kevin Beeley

Kevin Beeley

  • 140 Points 100 badge 2x thumb
 Ezequiel,

I've now been able to spend a little time on this, tried assembling my own code, and I'm afraid I'm still pretty confused; I'm not naturally a Javascript developer, which doesn't really help in this instance, but if I explain what I'm trying to achieve you may be able to point me in the right direction:

The displays in use are for meeting rooms.

When there is an active meeting, they are to display the details of the meeting.
When there is not an active meeting, they are to display a promotional presentation.

I do not believe that Risevision has any way of being able to select a presentation based on a a query, though I can see that being a useful feature for situations like this.

Within my own calendar application I can easily see if a meeting is active or not, and could trigger a presentation change from there;  it needs to be automated, and not manual - I don't want to have to go and click something on a web page to change it!

Ultimately, all I really want to do is submit a JSON file to update a schedule.  One JSON for meetings, one for promotions, and having a full copy of the API library running on my own app seems a little overkill for that!

Sorry if this seems a stupid question, but I really can't see where to go from here.
Photo of Scott Hardwick

Scott Hardwick

  • 126 Points 100 badge 2x thumb
Hope they can give you some answers Kevin.  I am quite lost myself with the API.  I have programmed to a number of them, but nothing quite so complex.  Can we just have a basic REST API?
Photo of Ezequiel Conte

Ezequiel Conte, Employee

  • 874 Points 500 badge 2x thumb
Hi Kevin,

I will think more about this scenario but the first idea that occurred to me is to have two Presentations defined: one that shows when there is an active meeting and the other with promotions. A Schedule should be defined with items for each meeting. Then, you could use the API to update/add/remove the Schedule items whenever the schedule is updated in your app.

Another option, in case you have an API for your meetings, is to use our HTML Widget or WebPage widget and develop a custom page or JS code for rotating the meeting/promotions.

Thanks!
Photo of Kevin Beeley

Kevin Beeley

  • 140 Points 100 badge 2x thumb
Ezequiel,

Thank you for your response.  The two presentation idea is exactly where I was going with this, but as I mentioned, the full API is just overkill, and frankly the developer documentation is hard to follow!  At present, I am using the HTML widget and my own logic to insert some static adverts, but as they would like some videos and other inserts I cannot use entirely my own logic and hope the displays follow.

I think a simple example of how the API schedule update could be used would be very helpful; unattended is definitely the way forward, and I look forward to your response!

Cheers,

Kev
Photo of Ezequiel Conte

Ezequiel Conte, Employee

  • 874 Points 500 badge 2x thumb
Hi Kevin,

you don't necessarily need to load the entire library. Our API is RESTful and you could use plain HTTP requests if you prefer. As the documentation is not very clear about the REST URLs, you can make some calls and grab the URLs from dev console. We know we need to improve that, sorry.

Unfortunately I don't have an example for you other than those provided in the documentation and our repositories.

Cheers