curl -X POST https://2md.link/api/convert -H "Content-Type: application/json" -d '{"url":"https://example.com"}'
curl https://2md.link/api/convert/example.com
curl https://2md.link/https://example.com
import requests
url = "https://2md.link/api/convert"
data = {"url": "https://example.com"}
r = requests.post(url, json=data)
print(r.json()["markdown"])
r = requests.get("https://2md.link/api/convert/example.com")
print(r.json()["markdown"])
const res = await fetch("https://2md.link/api/convert", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ url: "https://example.com" })
});
const { markdown } = await res.json();
const res = await fetch("https://2md.link/api/convert/example.com");
const { markdown } = await res.json();
package main
import (
"encoding/json"
"fmt"
"net/http"
"bytes"
)
func main() {
data := map[string]string{"url": "https://example.com"}
jsonData, _ := json.Marshal(data)
resp, _ := http.Post("https://2md.link/api/convert",
"application/json", bytes.NewBuffer(jsonData))
defer resp.Body.Close()
}
resp, _ := http.Get("https://2md.link/api/convert/example.com")
use reqwest;
use serde_json::json;
[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = reqwest::Client::new();
let res = client.post("https://2md.link/api/convert")
.json(&json!({"url": "https://example.com"}))
.send()
.await?;
let body = res.text().await?;
}
let res = client.get("https://2md.link/api/convert/example.com").send().await?;
require 'net/http'
require 'json'
uri = URI('https://2md.link/api/convert')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri)
req['Content-Type'] = 'application/json'
req.body = { url: 'https://example.com' }.to_json
res = http.request(req)
puts JSON.parse(res.body)['markdown']
res = Net::HTTP.get_response('2md.link', '/api/convert/example.com')
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://2md.link/api/convert"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{\"url\":\"https://example.com\"}"))
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://2md.link/api/convert/example.com"))
.GET()
.build();
$ch = curl_init("https://2md.link/api/convert");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"url" => "https://example.com"
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$data = json_decode($response, true);
echo $data["markdown"];
$response = file_get_contents("https://2md.link/api/convert/example.com");
using System.Net.Http;
using System.Text.Json;
var client = new HttpClient();
var content = new StringContent(
JsonSerializer.Serialize(new { url = "https://example.com" }),
Encoding.UTF8,
"application/json"
);
var response = await client.PostAsync("https://2md.link/api/convert", content);
var result = JsonSerializer.DeserializeAsync<JsonElement>(response.Content.ReadAsStream());
var response = await client.GetAsync("https://2md.link/api/convert/example.com");
import Foundation
let url = URL(string: "https://2md.link/api/convert")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try! JSONEncoder().encode(["url": "https://example.com"])
let (data, _) = try! await URLSession.shared.data(for: request)
let url = URL(string: "https://2md.link/api/convert/example.com")!
let (data, _) = try! await URLSession.shared.data(from: url)
curl -X POST https://2md.link/api/convert -H "Content-Type: application/json" -d '{"url":"https://example.com"}'
curl https://2md.link/api/convert/example.com
wget -qO- --post-data='{"url":"https://example.com"}' --header="Content-Type: application/json" https://2md.link/api/convert