Skip to content

Commit

Permalink
docs(api): write api documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Laur04 committed Jun 6, 2022
1 parent be984eb commit e83de5b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
39 changes: 31 additions & 8 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,39 @@ For the time being, each user of the API must recieve a unique identifier in ord

## Usage

### Normal Operation
There is one fields that you need for all API operations:
- unique_identifier: Identifies the origination of the request.

## Add inside
requests.post("http://beethoven.csl.tjhsst.edu/api/add/", data={"unique_identifier":"test", "source":"198.38.15.46", "group":"198.38.15.77", "inside_request":"True"}).content
For adding streams, you need two additional fields:
- source: IP address of the stream's source
- group: IP address of the stream's group

You can add streams like:
```
requests.post("https://menu.m2icast.net/api/add/", data={"unique_identifier":"<UID>", "source":"<SOURCE_IP>", "group":"<GROUP_IP>"}).content
```

## Remove inside
requests.post("http://beethoven.csl.tjhsst.edu/api/remove/", data={"unique_identifier":"test", "access_code":"8ZMXL14MLAh0pQ7NTcGYZOCBRrOhg3GaY9X0y4bW"}).content
The ".content" at the end is important in order to capture the return value, which is a unique idenfier for the stream that has been added. This access code will be important to delete the stream later.

## Add API
requests.post("http://beethoven.csl.tjhsst.edu/api/add/", data={"unique_identifier":"test", "source":"198.38.15.46", "group":"198.38.15.77"}).content
For removing streams, you only need one additional field:
- access_code: The stream's access code

## Remove API
requests.post("http://beethoven.csl.tjhsst.edu/api/remove/", data={"unique_identifier":"test", "access_code":"8ZMXL14MLAh0pQ7NTcGYZOCBRrOhg3GaY9X0y4bW"}).content
You can remove streams like:
```
requests.post("https://menu.m2icast.net/api/remove/", data={"unique_identifier":"<UID>", "access_code":"<STREAM_ACCESS_CODE>"}).content
```


### Inside Operation
Multicast Menu actually allows users to upload their own files and have them translated from unicast to multicast using a translation server. If you would like your translation server to be one that Multicast Menu uses to translate these uploaded files, please start by contacting a site admin so that they can mark your translator correctly. Once that has been done, ensure that your code is responding to packets from the Multicast Menu server correctly. You can find sample code for that at [https://github.com/JNPRAutomate/unicast2multicast-translator](https://github.com/JNPRAutomate/unicast2multicast-translator). Generally, ensure that your "inside" API requests look like:

Adding a Stream:
```
requests.post("https://menu.m2icast.net/api/add/", data={"unique_identifier":"<UID>", "source":"<SOURCE_IP>", "group":"<GROUP_IP>", "inside_request":"True"}).content
```

Removing a Stream:
```
requests.post("https://menu.m2icast.net/api/remove/", data={"unique_identifier":"<UID>", "access_code":"<STREAM_ACCESS_CODE>"}).content
```
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Multicast Menu provides a collection of all the multicast video streams availabl


## Usage
This site can be found at [https://multicastmenu.m2icast.net](https://multicastmenu.m2icast.net). In order for the streams that it links to to run properly on your machine, you will need [VLC 4.0 or later](https://nightlies.videolan.org/) installed.
This site can be found at [https://menu.m2icast.net](https://menu.m2icast.net). In order for the streams that it links to to run properly on your machine, you will need [VLC 4.0 or later](https://nightlies.videolan.org/) installed.

To manually run the stream collection scripts used by this site, see the [multicast/stream_collection_scripts](https://github.com/Laur04/multicast-menu/tree/master/multicast/stream_collection_scripts) folder.

Expand Down

0 comments on commit e83de5b

Please sign in to comment.