@paul14
I see you asking about this in several places today, so I'll tag you here and respond.
I was looking for a way to use the Canvas Data Services Live Events going directly to https rather than SQS. I tested something in our beta instance, but there's not much happening there and I didn't get any results (it might have been the code I was using). When that didn't work, I got lead me down the path of webhooks and a lot of confusion and despair.
However, I just managed to get it working relatively simply without using the API at all and without any fancy OAuth requirements. When you leave off the sign the payload, it comes through as plain text.
When you go to Admin > Data Services, there is a Documentation Tab that tells you how to set up a data stream. There is also an Event Format where you can see all of the event formats for Canvas or Caliper IMS. That said it was going a little crazy for me and not completely reliable (it seemed to be making 100's of requests to fetch one json string). You can also find examples of the events while you care adding a new stream.
To add a new data stream ...
- Go to Admin > Data Services.
- Click +Add to create a data stream.
- Give it a name
- Set the Delivery Method to HTTPS
- Change the URL to something you have access to. I just directed it to a PHP file I had on my server that required no authentication to get to.
- You can sign the payload if you like. Signing it is more secure and it comes through as JWT if you do. Without signing it, it comes through as plain text.
- Set the Message Type to Canvas. You can use Caliper 1.1 if you like, but Canvas provides more useful information.
- The Application Type is Data Streaming (only choice)
- Go through and select the subscriptions that you would like. For testing purposes, I chose everything under Logged (logged_in and logged_out) for both user generated and system generated events.
- Click Save & Exit.
You can tell what the events will look like by clicking on the event. For example, when I click on logged_in, I get an example event.
My PHP program for testing purposes? It was really quite simple (no error checking). The newline character in my fwrite() was so each entry came out on a separate line in the log file. It just made it easier to human-read.
<?php
$data = file_get_contents('php:
$fh = fopen('/tmp/liveevents.txt', 'a');
fwrite($fh, $data . "\n");
fclose($fh);
You could take the $data and use $events = json_decode($data, TRUE); and then act on the contents directly rather than logging to a file. I was just trying to see if it would work, and it did.
Hope this helps.
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.