-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add api auth, improve getting started, remove livestream
- Loading branch information
Yohan Totting
committed
Jul 9, 2024
1 parent
0078705
commit 4162d6e
Showing
8 changed files
with
108 additions
and
1,166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
date: 2024-07-08 | ||
lastmod: 2024-07-08 | ||
name: api-auth | ||
title: API Authentication | ||
description: Learn how to authenticate your application for access to Inlive APIs using an application key and access token. | ||
ogimage: /images/docs/og-image.png | ||
slug: api-auth | ||
menu: | ||
docs_sidebar: | ||
identifier: api-auth | ||
name: API Authentication | ||
parent: getting-started | ||
weight: 1 | ||
--- | ||
|
||
## Get an Application Key | ||
To allow your app to access all Inlive APIs, you need an application key, also known as an API key. This application key is unique per application, and you will need to use it with all your API requests. Follow these steps to create your application key: | ||
1. Register [an Inlive account](#). | ||
2. Go to [the integration page](#). | ||
3. Create an application key. Make sure you copy the key after you create it because you won't be able to see it again later. | ||
|
||
## Authenticate Your API Request | ||
The application key cannot be used directly with Inlive product APIs; instead, you need to generate an access token from the application key. The access token is a temporary token that will be used to authenticate your API requests. The access token will expire after a certain time, so you need to generate a new access token when the current one expires. | ||
|
||
### Generate an Access Token | ||
To generate an access token, you need to make a request to [the access token endpoint](https://api.inlive.app/apidocs/index.html#/apikeys/post_keys_accesstoken) with your application key. Here is an example of how to generate an access token using the `curl` command: | ||
```bash | ||
curl -X 'POST' \ | ||
'https://api.inlive.app/v1/keys/accesstoken' \ | ||
-H 'accept: application/json' \ | ||
-H 'Authorization: Bearer <your-apikey-here>' \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{ | ||
"expiry_seconds": 3600 | ||
}' | ||
``` | ||
|
||
Use the access token as a bearer token in your API requests. Please note that although you can set the expiration time of the access token when you generate it, make sure not to set it too long as it could be a security risk. The recommended and default expiration time is 1 hour. | ||
|
||
### Refresh an Access Token | ||
The access token will expire after a certain time. All Inlive product APIs will validate your request using the validate endpoint. When the request returns an HTTP response code 403 Forbidden, and the response header has an X-Access-Token-Expired header, it means your access token has expired, and you need to refresh it. To refresh it, you need to generate a new access token as described above, using the same application key. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,76 @@ | ||
--- | ||
date: 2023-08-02 | ||
lastmod: 2023-08-02 | ||
lastmod: 2024-08-09 | ||
name: using-hub-api | ||
title: Using Hub API | ||
description: | ||
title: Using the Hub API | ||
description: Learn how to integrate the Hub API into your application for real-time online interactions. | ||
ogimage: /images/docs/og-image.png | ||
slug: using-hub-api | ||
menu: | ||
docs_sidebar: | ||
identifier: using-hub-api | ||
name: Using Hub API | ||
name: Using the Hub API | ||
parent: getting-started | ||
weight: 2 | ||
--- | ||
|
||
# Using Hub API | ||
# Using the Hub API | ||
|
||
Learn how to use and integrate the Hub API into your application | ||
Learn how to use and integrate the Hub API into your application for enabling real-time online interactions. | ||
|
||
## About Hub API | ||
## About the Hub API | ||
|
||
The Hub API provides ways to enable real-time online interactions between multiple hosts and participants inside a room. It is built on top of WebRTC SFU (Selective Forwarding Unit) technology which will route the media stream from one peer to another peer in the same group with very low latency. | ||
The Hub API facilitates real-time online interactions between multiple hosts and participants within a room. It leverages WebRTC SFU (Selective Forwarding Unit) technology to efficiently route media streams among peers in the same group, ensuring very low latency. | ||
|
||
The current Hub API supports the basic features such as: | ||
- Multi group, a possibility to create multi room for different group of peers. | ||
- Group call, where all peers in the same group can send and receive media stream to each other. | ||
- Real-time signaling channel, that enables client to receive an event from the channel server in a real-time. | ||
- Perfect negotiation, enable to add additional track in the middle of the session such as screen sharing track. | ||
The Hub API currently supports features such as: | ||
- Multi-group capabilities, allowing the creation of multiple rooms for different groups of peers. | ||
- Group calls, enabling all peers in the same group to send and receive media streams to and from each other. | ||
- A real-time signaling channel, which allows clients to receive events from the channel server in real-time. | ||
- Perfect negotiation, which allows the addition of extra tracks (e.g., for screen sharing) during an ongoing session. | ||
|
||
## Making a request | ||
## Making a Request | ||
|
||
The Hub API can be accessed from `https://hub.inlive.app`. To make a request for a specific feature, you need to identify the specific API endpoint you want to use and provide any requirements that the endpoint may require. You can check our list of Hub API endpoints within our [API reference docs](https://hub.inlive.app/apidocs/index.html). | ||
The Hub API is accessible at `https://hub.inlive.app`. To utilize a specific feature, identify the relevant API endpoint and provide the required parameters. Our [API reference documentation](https://hub.inlive.app/apidocs/index.html) lists all available Hub API endpoints. | ||
|
||
### Your first room | ||
## Authentication | ||
|
||
You can start by making your first request to the create a room endpoint. Basically this endpoint will create a new room and returns a JSON response data about the new room. Using `curl` command, we can run and trigger our first request using HTTP `POST` method. | ||
Accessing the Hub API requires authenticating your request with an access token. This temporary token authenticates your API requests but expires after a set period. When your access token expires, you will need to generate a new one. For instructions on generating an access token, refer to our [API authentication guide](/docs/getting-started/api-auth/). | ||
|
||
### Creating Your First Room | ||
|
||
Begin by creating a room using the endpoint for room creation. This endpoint generates a new room and returns JSON data about it. The following `curl` command demonstrates how to create a room using the HTTP `POST` method. | ||
|
||
```bash | ||
curl --request POST \ | ||
https://hub.inlive.app/v1/rooms/create \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{ "name": "My room" }' | ||
curl -X 'POST' \ | ||
'https://hub.inlive.app/v1/rooms/create' \ | ||
-H 'accept: application/json' \ | ||
-H 'Authorization: Bearer <your-accesstoken-here>' \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{ | ||
"name": "My Room" | ||
}' | ||
``` | ||
|
||
### Get the room data | ||
### Retrieving Room Data | ||
|
||
When the room is successfully created, you will receive a room `id` data which you can use it to run some available actions in the room. For example, you can get the data of the new room you just created by using the the room ID with this command. | ||
Upon successful room creation, you'll receive a room ID. This ID can be used to perform actions within the room, such as retrieving the room's data with the following command: | ||
|
||
```bash | ||
curl --request GET \ | ||
https://hub.inlive.app/v1/rooms/<YOUR_ROOM_ID> | ||
curl -X GET \ | ||
'https://hub.inlive.app/v1/rooms/<YOUR_ROOM_ID>' \ | ||
-H 'accept: application/json' \ | ||
-H 'Authorization: Bearer <your-accesstoken-here>' | ||
``` | ||
|
||
### Publishing and Subscribing to Media Streams | ||
|
||
With an active room, you can publish and subscribe to media streams. Whether you're publishing a single media stream for others to subscribe to or subscribing to streams from others depends on your use case. | ||
|
||
For a detailed guide on publishing and subscribing to media streams, refer to our tutorial on [developing a conference app with the Hub API](/docs/tutorials/hub-api/conference-app-with-hub-api/). | ||
|
||
## Resources | ||
|
||
- Read the [Hub API reference docs](https://hub.inlive.app/apidocs/index.html) | ||
- Read an [example tutorial about developing a conference app](/docs/tutorials/hub-api/conference-app-with-hub-api/) using Hub API. | ||
- Check out the [code example in GitHub](https://github.com/inlivedev/inlivedev.github.io/tree/main/examples/) | ||
- Explore our open source [Hub SFU library in GitHub](https://github.com/inlivedev/sfu) | ||
- Explore the [Hub API reference documentation](https://hub.inlive.app/apidocs/index.html). | ||
- Follow an [example tutorial on developing a conference app](/docs/tutorials/hub-api/conference-app-with-hub-api/) with the Hub API. | ||
- View [code examples on GitHub](https://github.com/inlivedev/inlivedev.github.io/tree/main/examples/). | ||
- Discover our open-source [Inlive Hub SFU library on GitHub](https://github.com/inlivedev/sfu). |
Oops, something went wrong.