HTTP Calls
This page lists the HTTP calls that make up the API:
- Make a New Share Session Request
- Stop an Active Share Session
- Retrieve Share Session Information
- Retrieve Share Sessions
- Retrieve Recent Share Sessions
Make a New Share Session Request
Make this call to create a share session on the Screenleap server. The request will return a
screenShareData
JSON object that you can use to start the presenter app.
Request
POST | https://api.screenleap.com/v2/screen-shares |
HEADERS | authtoken:<authtoken> |
The request can be customized by adding these optional query string parameters:
Param | Description | Presenter Apps |
externalId | An external ID to store with the share session. This ID can be used later to filter results in a GET request. It has a 192-character limit. A common use for this parameter is to store the ID of the customer initiating the share session from your system. | All |
showScreenleapBranding | Show Screenleap's branding in your shares for presenters and viewers Share sessions with this option are billed at the basic pricing tier level. | All |
presenterIpAddress or presenterCountryCode | Specify the country code for the presenter.
Screenleap has servers deployed in multiple countries. If you include the
presenterCountryCode for a share session, we will select the server closest to that country to host the share. If you
pass the presenterIpAddress (but not presenterCountryCode ), we will use that IP address to determine the country for the same purpose.
|
All |
Presenter first name | The first name of the presenter to display in the session launcher. | Install-free |
Presenter last name | The last name of the presenter to display in the session launcher. | Install-free |
screenSharingMode | The screen sharing mode to use during the share session. Supported values are NONE , SCREEN (default), SCREEN_WITH_EMBEDDED_PHOTO , and SCREEN_WITH_EMBEDDED_VIDEO . |
All |
videoMode | The video conferencing mode to use. Supported values are NONE , BROADCAST , and FULL (default). |
Install-free |
initialMediaSource | What to initially share when starting the session for installation-free shares. Supported values are SCREEN and
CAMERA . |
All |
useBroadcastAudio | Whether to use one-way broadcast audio from presenter to viewers. | All |
useComputerAudio | Whether to use 2-way computer audio conferencing. | All |
allowRecording | Whether to allow recording of the share session as a MP4 video. You can be notified via email or via a callback when the recording is ready. Recordings will automatically be deleted from our system after one week. | All |
recordOnStart | Whether to start recording when the share session is started. | All |
allowPause | Whether to allow presenters to pause when sharing their screens for installation-free shares. | Install-free |
pauseOnStart | Whether to start with the screen paused for installation-free shares. | Install-free |
allowRectangleMode | Whether to allow the presenter to enable sharing a portion of the presenter's screen using functionality provided by the add-on for installation-free shares. | Install-free |
enableRectangleModeOnStart | Whether to try to start in rectangle mode for installation-free shares. The add-on needs to be installed and running for this to succeed. | Install-free |
allowViewerMouse | Whether to allow the presenter to select a viewer that will be able to point things out things on the presenter's screen for installation-free shares. | Install-free |
enableViewerMouseOnJoin | Whether to try to give the last viewer to join the share session the ability to point things out on the presenter's screen for installation-free shares. The add-on needs to be installed and running for this to succeed. | Install-free |
allowRemoteControl | Whether to allow the presenter to select a viewer that will be able to control the presenter's computer for installation-free shares. This can be used for collaboration or for the presenter to get assistance from a viewer. | Install-free |
enableRemoteControlOnJoin | Whether to try to give the last viewer to join the share session the ability to control the presenter's computer for installation-free shares. The add-on needs to be installed and running for this to succeed. | Install-free |
allowChat | Whether to allow the chat feature during share session for installation-free shares. | Install-free |
showChatOnStart | Whether to show the chat box when the share session starts for installation-free shares. | Install-free |
title | A title to display in the presenter console and viewer top bar (if the top bar is visible).
This option is only relevant if showScreenleapBranding is false.
Defaults to the company name if not set. |
Native |
hideScreenToggle | Hides the selector in the console. This option allows the presenter to toggle between full screen and partial screen mode. Depending upon the presenter app, the partial screen mode could be sharing inside a rectangle or sharing a specific window. | Native |
openInRectangleMode | Whether to start the share session in rectangle mode. | Native |
openWholeScreen | Opens the share in whole-screen mode
(i.e. no green rectangle). You can combine openWholeScreen with openInRectangleMode
to start in rectangle mode where the rectangle fills up the entire screen. Be aware that using openWholeScreen
can result in poor performance if you are sharing a large screen. We recommend using the rectangle mode
when possible to only share the portion of the screen that needs to be shared. |
Native |
rectangleXPos, rectangleYPox, rectangleWidth, rectangleHeight | Specify the default size and position to which the rectangle viewport opens, if it opens (irrelevant for whole-screen sharing). All 4 parameters must be provided in order for the settings to be used. Minimum dimensions are 100 x 75. Values should be numeric only, and are interpreted as pixels. Rectangle must fit within the screen dimensions. If any one of the 4 values is missing or invalid, the others will be ignored. | Native |
rectangleColor | Specify the color for the rectangle. The color should be an RGB value represented as 6 hexadecimal characters. | Native |
rectangleOpacity | Specify the opacity for the rectangle. The opacity should be a decimal between 0 and 1. If not set, it defaults to 0.7 for the browser share extension and 0.8 for the other presenter apps. | Native |
hidePauseButton | Hides the console pause button. | Native |
startPaused | Starts the share session in paused mode. This is useful when the presenter wants to prepare their share session before making it available to viewers. | Native |
hideStopButton | Hides the console stop button. | Native |
viewerFitToWindow | By default, we resize the shared screen so that it fits in the viewer's browser window. If you want to display the shared screen at the actual size so that they see the highest quality image, then uncheck this option. | All |
maxConcurrentViewers | Limit the number of concurrent viewers that may view the share session at the same time. This will help you to control the cost of the share session. | All |
maxConcurrentViewers | Limit the number of concurrent viewers that may view the share session at the same time. This will help you to control the cost of the share session. | All |
Sample Request
curl -H "accountid:<accountid>" -H "authtoken:<authtoken>" -X POST https://api.screenleap.com/v2/screen-shares |
Response
A successful request will return a response with 200 status code and a JSON object. You will pass this JSON object
to the screenleap.startSharing
call to start the presenter app. The JSON object also includes a
viewerUrl
that you will be used for integrating the viewer.
See Error Responses for information on how to handle a failed request.
Stop an Active Share Session
Users can end their share session on their own by clicking the stop button or closing the console. There will likely be occasions, however, where you want to force the share session to close programmatically.
For example, if you have used the Screenleap API to integrate screen sharing into a web-based conference call application, you might choose to automatically stop the share session when the user clicks the button to end a call.
Request
The request URL must include the screenShareCode
, which identifies the share session to stop.
The request must be made using HTTPS. The accountid
and authtoken
must be provided for authentication.
Response
HTTP status codes are used to indicate the result of the request:
200 - OK | The message was sent to the share session successfully. When the presenter app closes, the screenleap.onScreenShareEnd JavaScript will be triggered, just as it is when a user clicks the stop button. |
401 - Unauthorized | The provided credential was missing or incorrect. See Authentication. |
403 - Forbidden | You are attempting to access a share session that you did not create through the Screenleap API. Check your share code. |
404 - Not Found | The share code that you are trying to stop does not exist or has already ended. |
Retrieve Share Session Information
This call retrieves information about the specified share session.
Request
The request URL must include the screenShareCode
, which identifies the share session to retrieve.
Response
HTTP status codes are used to indicate the result of the request:
200 - OK | The request was made successfully. The response will contain information about the share session in JSON format. |
401 - Unauthorized | The provided credential was missing or incorrect. See Authentication. |
If the request is successful, the response will contain JSON content, as described below.
Retrieve Share Sessions
This call retrieves information for successful share sessions that match the specified criteria. A successful share session is one to which both the presenter and one or more viewers connect. Recently completed share sessions are not included. Only the first 1000 results matching the criteria are returned.
No paging is supported. If you receive 10,000 results in the response, you can retrieve the next 10,000 results by setting startedAfter to the start time of the last result in the previous query.
Please see below for the call to retrieve recently completed share sessions and share sessions that are currently active.
Request
The request can be customized by adding optional query string parameters:
startedBefore | The start time (in milliseconds from epoch time) to be used as a filter. Only share sessions that started before this time will be returned. |
startedAfter | The time (in milliseconds from epoch time) to be used as a filter. Only share sessions that started after this time will be returned. |
endedBefore | The end time (in milliseconds from epoch time) to be used as a filter. Only share sessions that ended before this time will be returned. |
endedAfter | The time (in milliseconds from epoch time) to be used as a filter. Only share sessions that ended after this time will be returned. |
dateFormat | Optional. The format for the passed in dates, whose pattern conforms with Java's SimpleDateFormat. If not specified, the dates passed in can be in milliseconds from epoch time or one of the following default formats: "dd/MM/yy", "dd/MM/yy HH:mm:ss z". |
externalId | The external ID to be used as a filter. Only share sessions that were created with this value as the externalId will be returned. |
Response
HTTP status codes are used to indicate the result of the request:
200 - OK | The request was made successfully. The response will contain the share sessions in JSON format. |
401 - Unauthorized | The provided credential was missing or incorrect. See Authentication. |
If the request is successful, the response will contain a JSON array of share session data, as described below.
Retrieve Recent Share Sessions
This call retrieves information for the recent share sessions on the account. This includes share sessions that are still waiting for a presenter to connect, currently active, or recently ended (within the last 5 minutes).
Request
Response
HTTP status codes are used to indicate the result of the request:
200 - OK | The request was made successfully. The response will contain the share sessions in JSON format. |
401 - Unauthorized | The provided credential was missing or incorrect. See Authentication. |
If the request is successful, the response will contain a JSON array of share session data, as described below.
Share Session JSON
The share session JSON objects returned to the above GET
requests may include the following elements:
- sessionId: The 9-digit share code assigned to this share session.
- dateCreated: The time (in milliseconds from epoch time) at which the share was created.
- accountId: The Screenleap API account id which was used to create this share session.
- externalId: The external ID which was assigned to this share session, if any.
- isSecure: A boolean signifying whether SSL was used for this share session.
- showScreenleapBranding: A boolean signifying whether Screenleap branding was used for this share session.
- isActive: For recent shares,
true
for shares to which both presenter and viewer have connected, but which have not ended yet. Note that there can be a delay of several minutes after a share ends before theisActive
flag gets reset tofalse
. This HTTP request should not be relied upon for realtime information; the JavaScript callback functions and Webhook URL should be used for that purpose. - startTime: The time (in milliseconds from epoch time) at which the share started.
- endTime: The time (in milliseconds from epoch time) at which the share ended.
- totalViewers: The number of viewers who connected to the share before it ended.
- userMinutes: For successful shares that have ended. This includes the sum of minutes each participant was in the share session (from first connection to last disconnection).
- costInCents: For successful shares that have ended, the total cost for this share, in cents.
- title: The custom title that was used for this share, if any.
- apiCallbackUrl: The URL to which Screenleap will post server-to-server callbacks on share start and end, if any. The Screenleap servers will make a POST request and the content will be of type "application/json".
- participants: A JSON array of information about the participants (presenter and viewer(s)) on this share. Each participant
JSON object may include the following elements:
- participantId: The 6-digit code assigned to this participant for this share session.
- externalId: The external ID which was assigned to this viewer, if any.
- userAgent: The user agent for this participant's browser connection.
- sharingStartTime: The time (in milliseconds from epoch time) at which this participant first joined the active share.
- sharingEndTime: The time (in milliseconds from epoch time) at which this participant last left the active share.
- durationInMinutes: The number of minutes this participant was connected to the active share. Contributes to the share session
userMinutes
- isPresenter: A boolean signifying whether this participant was the presenter (true) or a viewer (false).