forked from amy/hosted
Update API documentation
parent
6caf2f9eed
commit
7d78968524
1 changed files with 0 additions and 414 deletions
414
api.md
414
api.md
|
@ -12,143 +12,6 @@ Discord user information lookup service
|
|||
|
||||
## Look up Discord user information
|
||||
|
||||
> Code samples
|
||||
|
||||
```shell
|
||||
# You can also use wget
|
||||
curl -X GET /v1/user/{userId} \
|
||||
-H 'Accept: application/json'
|
||||
|
||||
```
|
||||
|
||||
```http
|
||||
GET /v1/user/{userId} HTTP/1.1
|
||||
|
||||
Accept: application/json
|
||||
|
||||
```
|
||||
|
||||
```javascript
|
||||
|
||||
const headers = {
|
||||
'Accept':'application/json'
|
||||
};
|
||||
|
||||
fetch('/v1/user/{userId}',
|
||||
{
|
||||
method: 'GET',
|
||||
|
||||
headers: headers
|
||||
})
|
||||
.then(function(res) {
|
||||
return res.json();
|
||||
}).then(function(body) {
|
||||
console.log(body);
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
```ruby
|
||||
require 'rest-client'
|
||||
require 'json'
|
||||
|
||||
headers = {
|
||||
'Accept' => 'application/json'
|
||||
}
|
||||
|
||||
result = RestClient.get '/v1/user/{userId}',
|
||||
params: {
|
||||
}, headers: headers
|
||||
|
||||
p JSON.parse(result)
|
||||
|
||||
```
|
||||
|
||||
```python
|
||||
import requests
|
||||
headers = {
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
|
||||
r = requests.get('/v1/user/{userId}', headers = headers)
|
||||
|
||||
print(r.json())
|
||||
|
||||
```
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
$headers = array(
|
||||
'Accept' => 'application/json',
|
||||
);
|
||||
|
||||
$client = new \GuzzleHttp\Client();
|
||||
|
||||
// Define array of request body.
|
||||
$request_body = array();
|
||||
|
||||
try {
|
||||
$response = $client->request('GET','/v1/user/{userId}', array(
|
||||
'headers' => $headers,
|
||||
'json' => $request_body,
|
||||
)
|
||||
);
|
||||
print_r($response->getBody()->getContents());
|
||||
}
|
||||
catch (\GuzzleHttp\Exception\BadResponseException $e) {
|
||||
// handle exception or api errors.
|
||||
print_r($e->getMessage());
|
||||
}
|
||||
|
||||
// ...
|
||||
|
||||
```
|
||||
|
||||
```java
|
||||
URL obj = new URL("/v1/user/{userId}");
|
||||
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
|
||||
con.setRequestMethod("GET");
|
||||
int responseCode = con.getResponseCode();
|
||||
BufferedReader in = new BufferedReader(
|
||||
new InputStreamReader(con.getInputStream()));
|
||||
String inputLine;
|
||||
StringBuffer response = new StringBuffer();
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
response.append(inputLine);
|
||||
}
|
||||
in.close();
|
||||
System.out.println(response.toString());
|
||||
|
||||
```
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
headers := map[string][]string{
|
||||
"Accept": []string{"application/json"},
|
||||
}
|
||||
|
||||
data := bytes.NewBuffer([]byte{jsonReq})
|
||||
req, err := http.NewRequest("GET", "/v1/user/{userId}", data)
|
||||
req.Header = headers
|
||||
|
||||
client := &http.Client{}
|
||||
resp, err := client.Do(req)
|
||||
// ...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
`GET /v1/user/{userId}`
|
||||
|
||||
Retrieves information about a Discord user using their ID
|
||||
|
@ -218,143 +81,6 @@ Backend review system for website
|
|||
|
||||
## Get reviews
|
||||
|
||||
> Code samples
|
||||
|
||||
```shell
|
||||
# You can also use wget
|
||||
curl -X GET /getreviews \
|
||||
-H 'Accept: application/json'
|
||||
|
||||
```
|
||||
|
||||
```http
|
||||
GET /getreviews HTTP/1.1
|
||||
|
||||
Accept: application/json
|
||||
|
||||
```
|
||||
|
||||
```javascript
|
||||
|
||||
const headers = {
|
||||
'Accept':'application/json'
|
||||
};
|
||||
|
||||
fetch('/getreviews',
|
||||
{
|
||||
method: 'GET',
|
||||
|
||||
headers: headers
|
||||
})
|
||||
.then(function(res) {
|
||||
return res.json();
|
||||
}).then(function(body) {
|
||||
console.log(body);
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
```ruby
|
||||
require 'rest-client'
|
||||
require 'json'
|
||||
|
||||
headers = {
|
||||
'Accept' => 'application/json'
|
||||
}
|
||||
|
||||
result = RestClient.get '/getreviews',
|
||||
params: {
|
||||
}, headers: headers
|
||||
|
||||
p JSON.parse(result)
|
||||
|
||||
```
|
||||
|
||||
```python
|
||||
import requests
|
||||
headers = {
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
|
||||
r = requests.get('/getreviews', headers = headers)
|
||||
|
||||
print(r.json())
|
||||
|
||||
```
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
$headers = array(
|
||||
'Accept' => 'application/json',
|
||||
);
|
||||
|
||||
$client = new \GuzzleHttp\Client();
|
||||
|
||||
// Define array of request body.
|
||||
$request_body = array();
|
||||
|
||||
try {
|
||||
$response = $client->request('GET','/getreviews', array(
|
||||
'headers' => $headers,
|
||||
'json' => $request_body,
|
||||
)
|
||||
);
|
||||
print_r($response->getBody()->getContents());
|
||||
}
|
||||
catch (\GuzzleHttp\Exception\BadResponseException $e) {
|
||||
// handle exception or api errors.
|
||||
print_r($e->getMessage());
|
||||
}
|
||||
|
||||
// ...
|
||||
|
||||
```
|
||||
|
||||
```java
|
||||
URL obj = new URL("/getreviews");
|
||||
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
|
||||
con.setRequestMethod("GET");
|
||||
int responseCode = con.getResponseCode();
|
||||
BufferedReader in = new BufferedReader(
|
||||
new InputStreamReader(con.getInputStream()));
|
||||
String inputLine;
|
||||
StringBuffer response = new StringBuffer();
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
response.append(inputLine);
|
||||
}
|
||||
in.close();
|
||||
System.out.println(response.toString());
|
||||
|
||||
```
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
headers := map[string][]string{
|
||||
"Accept": []string{"application/json"},
|
||||
}
|
||||
|
||||
data := bytes.NewBuffer([]byte{jsonReq})
|
||||
req, err := http.NewRequest("GET", "/getreviews", data)
|
||||
req.Header = headers
|
||||
|
||||
client := &http.Client{}
|
||||
resp, err := client.Do(req)
|
||||
// ...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
`GET /getreviews`
|
||||
|
||||
Retrieves reviews from the backend review system
|
||||
|
@ -402,146 +128,6 @@ Cached proxy for song.link API
|
|||
|
||||
## Get cached song.link data
|
||||
|
||||
> Code samples
|
||||
|
||||
```shell
|
||||
# You can also use wget
|
||||
curl -X GET /?url=spotify%3Atrack%3A6BJHsLiE47Sk0wQkuppqhr \
|
||||
-H 'Accept: application/json'
|
||||
|
||||
```
|
||||
|
||||
```http
|
||||
GET /?url=spotify%3Atrack%3A6BJHsLiE47Sk0wQkuppqhr HTTP/1.1
|
||||
|
||||
Accept: application/json
|
||||
|
||||
```
|
||||
|
||||
```javascript
|
||||
|
||||
const headers = {
|
||||
'Accept':'application/json'
|
||||
};
|
||||
|
||||
fetch('/?url=spotify%3Atrack%3A6BJHsLiE47Sk0wQkuppqhr',
|
||||
{
|
||||
method: 'GET',
|
||||
|
||||
headers: headers
|
||||
})
|
||||
.then(function(res) {
|
||||
return res.json();
|
||||
}).then(function(body) {
|
||||
console.log(body);
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
```ruby
|
||||
require 'rest-client'
|
||||
require 'json'
|
||||
|
||||
headers = {
|
||||
'Accept' => 'application/json'
|
||||
}
|
||||
|
||||
result = RestClient.get '/',
|
||||
params: {
|
||||
'url' => 'string'
|
||||
}, headers: headers
|
||||
|
||||
p JSON.parse(result)
|
||||
|
||||
```
|
||||
|
||||
```python
|
||||
import requests
|
||||
headers = {
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
|
||||
r = requests.get('/', params={
|
||||
'url': 'spotify:track:6BJHsLiE47Sk0wQkuppqhr'
|
||||
}, headers = headers)
|
||||
|
||||
print(r.json())
|
||||
|
||||
```
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
$headers = array(
|
||||
'Accept' => 'application/json',
|
||||
);
|
||||
|
||||
$client = new \GuzzleHttp\Client();
|
||||
|
||||
// Define array of request body.
|
||||
$request_body = array();
|
||||
|
||||
try {
|
||||
$response = $client->request('GET','/', array(
|
||||
'headers' => $headers,
|
||||
'json' => $request_body,
|
||||
)
|
||||
);
|
||||
print_r($response->getBody()->getContents());
|
||||
}
|
||||
catch (\GuzzleHttp\Exception\BadResponseException $e) {
|
||||
// handle exception or api errors.
|
||||
print_r($e->getMessage());
|
||||
}
|
||||
|
||||
// ...
|
||||
|
||||
```
|
||||
|
||||
```java
|
||||
URL obj = new URL("/?url=spotify%3Atrack%3A6BJHsLiE47Sk0wQkuppqhr");
|
||||
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
|
||||
con.setRequestMethod("GET");
|
||||
int responseCode = con.getResponseCode();
|
||||
BufferedReader in = new BufferedReader(
|
||||
new InputStreamReader(con.getInputStream()));
|
||||
String inputLine;
|
||||
StringBuffer response = new StringBuffer();
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
response.append(inputLine);
|
||||
}
|
||||
in.close();
|
||||
System.out.println(response.toString());
|
||||
|
||||
```
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
headers := map[string][]string{
|
||||
"Accept": []string{"application/json"},
|
||||
}
|
||||
|
||||
data := bytes.NewBuffer([]byte{jsonReq})
|
||||
req, err := http.NewRequest("GET", "/", data)
|
||||
req.Header = headers
|
||||
|
||||
client := &http.Client{}
|
||||
resp, err := client.Do(req)
|
||||
// ...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
`GET /`
|
||||
|
||||
Cached proxy for song.link API responses with CORS support
|
||||
|
|
Loading…
Reference in a new issue