docs: fix prose linting errors

- Properly enclose code between triple backticks
- Put paths and url between backticks
- Remove links <> enclosing
- Libretime styled name is LibreTime
- Put urls and paths betwen backticks
- Use sentence like capitalization for headings
- Put tools name between backticks
- Update links
This commit is contained in:
jo 2022-02-10 12:15:23 +01:00 committed by Jonas L
parent 75e3760f2e
commit 94d3c5e496
37 changed files with 414 additions and 319 deletions

View file

@ -1,20 +1,22 @@
---
title: LibreTime API Usage
title: LibreTime API usage
---
:::info
We're in the process of rewriting Libretime's API. This page contains the instructions for the current version, written in PHP.
We're in the process of rewriting LibreTime's API. This page contains the instructions for the current version, written in PHP.
:::
The LibreTime API enables many types of information about the broadcast schedule and configuration to be retrieved from the LibreTime server. Other than the live-info and week-info data fetched by website widgets (see the chapter _Exporting the schedule_), all API requests must be authenticated using the secret API key stored in the file _/etc/airtime/api_client.cfg_ on the LibreTime server. This key is autogenerated during LibreTime installation and should be unique for each server.
The LibreTime API enables many types of information about the broadcast schedule and configuration to be retrieved from the LibreTime server. Other than the live-info and week-info data fetched by website widgets (see the chapter _Exporting the schedule_), all API requests must be authenticated using the secret API key stored in the file `/etc/airtime/api_client.cfg` on the LibreTime server. This key is autogenerated during LibreTime installation and should be unique for each server.
If you intend to use the LibreTime API across a public network, for security reasons it is highly recommended that all API requests are sent over encrypted https: and that the web server is configured to accept requests to the api/ directory from specific host names or IP addresses only.
The format of API requests is:
https://libretime.example.com/api/api-action/format/json/api_key/XXXXXX
```
https://libretime.example.com/api/api-action/format/json/api_key/XXXXXX
```
where api-action is the type of request and XXXXXX is the secret API key. Available actions include:
@ -27,20 +29,21 @@ where api-action is the type of request and XXXXXX is the secret API key. Availa
For example, using the action _get-stream-setting_ returns the following output for the first configured stream:
{"keyname":"s1_type","value":"ogg","type":"string"},
```json
{"keyname":"s1_type","value":"ogg","type":"string"},
{"keyname":"s1_host","value":"streaming.example.com","type":"string"},
{"keyname":"s1_host","value":"streaming.example.com","type":"string"},
{"keyname":"s1_port","value":"8000","type":"integer"},
{"keyname":"s1_port","value":"8000","type":"integer"},
{"keyname":"s1_mount","value":"airtime_128","type":"string"},
{"keyname":"s1_mount","value":"airtime_128","type":"string"},
{"keyname":"s1_url","value":"http:\/\/airtime.sourcefabric.org","type":"string"},
{"keyname":"s1_url","value":"http:\/\/airtime.sourcefabric.org","type":"string"},
{"keyname":"s1_description","value":"Airtime Radio! Stream
#1","type":"string"},
{"keyname":"s1_description","value":"Airtime Radio! Stream #1","type":"string"},
{"keyname":"s1_genre","value":"Screamo","type":"string"},
{"keyname":"s1_genre","value":"Screamo","type":"string"},
```
which is enough information to construct a player widget dynamically. (s1_url is the station's homepage, not the stream URL). The same information is provided with an s2\_ prefix for the second stream, and s3\_ prefix for the third stream.
@ -51,11 +54,17 @@ Some API requests require the directory ID number to be specified as _dir_id_ in
For example, using a request such as:
http://libretime.example.com/api/list-all-files/format/json/api_key/XXXXXX/dir_id/1/
```
http://libretime.example.com/api/list-all-files/format/json/api_key/XXXXXX/dir_id/1/
```
returns the full path to each media file in the LibreTime storage directory:
{"files":[
"imported\/1\/Mark Ronson feat. Saigon\/Here Comes the Fuzz\/7-Diduntdidunt-unknown.flac",
"imported\/1\/Jimi Tenor & Tony Allen\/Inspiration Information\/3-Selfish Gene-128kbps.mp3",
"]}
```json
{
"files": [
"imported/1/Mark Ronson feat. Saigon/Here Comes the Fuzz/7-Diduntdidunt-unknown.flac",
"imported/1/Jimi Tenor & Tony Allen/Inspiration Information/3-Selfish Gene-128kbps.mp3"
]
}
```