cURL
curl -i -X POST 'https://social2api.com/api/account/otp/request' \
-H 'Content-Type: application/json' \
--data-binary '{
"email": "reader@example.com",
"locale": "zh"
}'
Python
from urllib.error import HTTPError
from urllib.request import Request, urlopen
request = Request(
"https://social2api.com/api/account/otp/request",
method="POST",
headers={
"Content-Type": "application/json",
},
data="{\"email\":\"reader@example.com\",\"locale\":\"zh\"}".encode("utf-8"),
)
send = urlopen
try:
with send(request) as response:
print(response.status, response.read().decode("utf-8"))
except HTTPError as error:
print(error.code, error.read().decode("utf-8"))
JavaScript
const response = await fetch("/api/account/otp/request", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
"email": "reader@example.com",
"locale": "zh"
}),
});
console.log(response.status, await response.text());