New in 2.4: Test runs you can trust See what's new →

Return a sample SVG image

GEThttps://api.testingapis.com/api/formats/svg

Responses

200
Success.

Example

Request
curl -X GET "https://api.testingapis.com/api/formats/svg"
Run in Studio
Response200 OK
Content-Type: image/svg+xml; charset=utf-8

<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
  <rect width="200" height="200" fill="#1e1e1e"/>
  <polygon points="100,20 170,60 170,140 100,180 30,140 30,60" fill="#ffc107"/>
  <text x="100" y="110" font-family="sans-serif" font-size="28" text-anchor="middle" fill="#1e1e1e">TestingAPIs</text>
</svg>

Code examples

JavaScript (fetch)
const response = await fetch("https://api.testingapis.com/api/formats/svg");
console.log(response.status, await response.text());
Python (requests)
import requests

response = requests.request(
    "GET",
    "https://api.testingapis.com/api/formats/svg",
    allow_redirects=False,
)
print(response.status_code, response.text)
Java (HttpClient)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newBuilder()
            .followRedirects(HttpClient.Redirect.NEVER)
            .build();

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.testingapis.com/api/formats/svg"))
            .method("GET", HttpRequest.BodyPublishers.noBody())
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode() + " " + response.body());
    }
}