Start an asynchronous job
POST
https://api.testingapis.com/api/jobsExample body: {"type":"report","durationSeconds":10} Returns 202 with a Location header pointing at the job and a Retry-After hint. Poll that URL; the job is queued for 2 seconds, then runs for durationSeconds. When it completes, fetch resultUrl.
Request body
Optional. application/json, text/json, application/*+json, application/xml, text/xml, application/*+xml. Model: JobsControllerJobRequest. Job type and duration. An empty body starts a 10-second report job.
Example body
{"type": "report", "durationSeconds": 10}Responses
- 200
- OK
- 202
- Job accepted; poll the Location URL.
- 400
- Unknown type or duration out of range.
Example
Request
curl -X POST "https://api.testingapis.com/api/jobs" \
-H "Content-Type: application/json" \
-d '{"type": "report", "durationSeconds": 10}'Response202 Accepted
Location: /api/jobs/job_1002
Retry-After: 2
{
"message": "Job accepted. Poll the Location URL for status.",
"data": {
"id": "job_1002",
"type": "report",
"status": "queued",
"progress": 0,
"durationSeconds": 10,
"createdAt": "2026-09-30T18:26:45Z",
"startedAt": null,
"finishedAt": null,
"statusUrl": "/api/jobs/job_1002",
"resultUrl": null,
"error": null
… (1 more lines)Code examples
JavaScript (fetch)
const response = await fetch("https://api.testingapis.com/api/jobs", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: "{\"type\": \"report\", \"durationSeconds\": 10}",
});
console.log(response.status, await response.text());Python (requests)
import requests
response = requests.request(
"POST",
"https://api.testingapis.com/api/jobs",
headers={
"Content-Type": "application/json",
},
data="{\"type\": \"report\", \"durationSeconds\": 10}".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/jobs"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"type\": \"report\", \"durationSeconds\": 10}"))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}