Accepts any verb and describes the request
GETPOSTPUTPATCHDELETEHEADOPTIONS
https://api.testingapis.com/api/methods/anyThe body is read for POST, PUT, PATCH and DELETE, and ignored for GET, HEAD and OPTIONS.
Request body
Optional. application/json. Optional body; described in the response.
Example body
{"a": 1}Responses
- 200
- Method, query, content type and body.
Example
Request
curl -X POST "https://api.testingapis.com/api/methods/any" \
-H "Content-Type: application/json" \
-d '{"a": 1}'Response200 OK
{
"method": "POST",
"message": "POST request received",
"path": "/api/methods/any",
"query": {},
"contentType": "application/json",
"bodyLength": 8,
"bodyTruncated": false,
"body": "{\"a\": 1}",
"timestamp": "2026-09-30T18:26:44Z"
}Code examples
JavaScript (fetch)
const response = await fetch("https://api.testingapis.com/api/methods/any", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: "{\"a\": 1}",
});
console.log(response.status, await response.text());Python (requests)
import requests
response = requests.request(
"POST",
"https://api.testingapis.com/api/methods/any",
headers={
"Content-Type": "application/json",
},
data="{\"a\": 1}".encode("utf-8"),
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/methods/any"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"a\": 1}"))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}