Test page
Body
inputintegerOptionalExample:
5Responses
200
Successfully multiplied the input by 2
application/json
400
Invalid input. Input must be an integer.
application/json
post
/multiplyimport requests
url = "http://api.example.com/multiply"
payload = {"input": 5}
response = requests.post(url, json=payload)
if response.status_code == 200:
result = response.json().get("result")
print(f"Result: {result}")
else:
print(f"Error: {response.json().get('error')}")
{
"result": 10
}Body
inputintegerOptionalExample:
5Responses
200
Successfully multiplied the input by 2
application/json
400
Invalid input. Input must be an integer.
application/json
post
/multiplyPOST /multiply HTTP/1.1
Host:
Content-Type: application/json
Accept: */*
Content-Length: 11
{
"input": 5
}{
"result": 10
}Last updated