> 2MD.LINK_ v1.0
> FETCHING DATA...
# POST - Convert URL to markdown # cURL curl -X POST https://2md.link/api/convert -H "Content-Type: application/json" -d '{"url":"https://example.com"}' # GET - Simple URL pass curl https://2md.link/api/convert/example.com # GET - With protocol curl https://2md.link/https://example.com
# POST - Python requests import requests url = "https://2md.link/api/convert" data = {"url": "https://example.com"} r = requests.post(url, json=data) print(r.json()["markdown"]) # GET - Python r = requests.get("https://2md.link/api/convert/example.com") print(r.json()["markdown"])
// POST - TypeScript/Fetch 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(); // GET - TypeScript const res = await fetch("https://2md.link/api/convert/example.com"); const { markdown } = await res.json();
// POST - Go 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() // ... handle response } // GET - Go resp, _ := http.Get("https://2md.link/api/convert/example.com")
// POST - Rust 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?; // ... handle response } // GET - Rust let res = client.get("https://2md.link/api/convert/example.com").send().await?;
# POST - Ruby 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'] # GET - Ruby res = Net::HTTP.get_response('2md.link', '/api/convert/example.com')
// POST - Java 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()); // GET - Java HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://2md.link/api/convert/example.com")) .GET() .build();
<?php // POST - PHP $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"]; // GET - PHP $response = file_get_contents("https://2md.link/api/convert/example.com");
// POST - C# 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()); // GET - C# var response = await client.GetAsync("https://2md.link/api/convert/example.com");
// POST - Swift 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) // GET - Swift let url = URL(string: "https://2md.link/api/convert/example.com")! let (data, _) = try! await URLSession.shared.data(from: url)
#!/bin/bash # POST - Bash curl -X POST https://2md.link/api/convert -H "Content-Type: application/json" -d '{"url":"https://example.com"}' # GET - Bash curl https://2md.link/api/convert/example.com # wget alternative wget -qO- --post-data='{"url":"https://example.com"}' --header="Content-Type: application/json" https://2md.link/api/convert