example with deno
const rawResponse = await fetch("https://anti-url-shortener.herokuapp.com/no-bitly", {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
url: `https://bit.ly/3nv15Ci`,
}),
});
const content = await rawResponse.json();
console.log(content);
example with curl
curl --location --request POST 'https://anti-url-shortener.herokuapp.com/no-bitly' \
--header 'Content-Type: application/json' \
--data-raw '{"url":"https://bit.ly/3nv15Ci"}'
example with python
import requests
import json
url = "https://anti-url-shortener.herokuapp.com/no-bitly"
payload = json.dumps({
"url": "https://bit.ly/3nv15Ci"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
example with nodejs (axios)
var axios = require('axios');
var data = JSON.stringify({
"url": "https://bit.ly/3nv15Ci"
});
var config = {
method: 'post',
url: 'https://anti-url-shortener.herokuapp.com/no-bitly',
headers: {
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});