Version: 1.0

Webview API

Initial draft of the Stagecast WebView API

Endpoints: join.stagecast.se

Contact: stefan@stagecast.se

Table of contents

Webview API

Webview API

1.0.0 Polling for active moments

Request

GET /api/events/{eventId}/moments/poll HTTP/1.1
Host: join.stagecast.se
Accept: application/json
Content-Type: application/json
Content-Length: 0

	  

Comment

Use host join.stagecast.se for development but change host to d5q8k8cx63nj4.cloudfront.net for a production environment where more traffic is expected. Replace {eventId} above with the event ID you find in the stagecast web frontend when you navigate to your event (you find it in the address field of the browser as part of the path when you navigate to your event). It is a uuid string on the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX, such as F5D6E9D6-5F1E-4A43-8348-0DA8BBAA29AF.

Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 344
Connection: close

[{"triggeredBy":"manual","rec...}, ...]
	  

Comment

A list of currently active moments or an empty list if there are none. Instead of relying on polling however, a better alternative is to request a notification integration between stagecast backend and your notification service. Then a user's phone will be awoken when a notification goes live.

1.1.0 Webview URL

Request

GET /api/web/events/{eventId}/{deviceId} HTTP/1.1
Host: join.stagecast.se
Accept: application/json
Content-Type: application/json

	  

Comment

This is the URL you give the webview in your app once a moment is loaded. The eventId is the eventId of the event. This will load the most recent active moment. The deviceId in the path is some unique string. Some moments, such as voting, relies on the fact that people have some unique identifier. Therefore it is suggested that the app generates a URL-friendly deviceId, store it in persistent storage on the phone and use that for each webview opening. This is to guarantee that a user may not vote several times etc. Instead of "events/{eventId}" it is also possible to use "code/{eventCode}". The eventId can be found in the web frontend on https://stagecast.se/login for your created event. Look in the URL path once you have navigated to your event - some uuid string such as F5D6E9D6-5F1E-4A43-8348-0DA8BBAA29AF or similar - and replace {eventId} in the request above with the uuid string you find.

Response

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: X
Connection: close

....whatever webview code there is
        

1.2.0 URL for joining moment in any browser

Request

GET / HTTP/1.1
Host: join.stagecast.se
Accept: application/json
Content-Type: application/json

	  

Comment

If you do not have an app but want people to join your moment from phone browsers you can direct them to stagecast.io where they can, on the top of the page, type in your four digit event code to join your active moment. If you are redirecting them from a website where you already know the code you can redirect them to https://join.stagecast.se/?code={code} - an example https://join.stagecast.se/?code=0001

Response

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: X
Connection: close

....whatever webview code there is