Api/Users
Create a new user
Create a new user
curl -X POST "https://demo.nextshell.dev/api/users" \
-H "Content-Type: application/json" \
-d '{
"id": "123",
"name": "John Doe",
"age": 42
}'const body = JSON.stringify({
"id": "123",
"name": "John Doe",
"age": 42
})
fetch("https://demo.nextshell.dev/api/users", {
body
})package main
import (
"fmt"
"net/http"
"io/ioutil"
"strings"
)
func main() {
url := "https://demo.nextshell.dev/api/users"
body := strings.NewReader(`{
"id": "123",
"name": "John Doe",
"age": 42
}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://demo.nextshell.dev/api/users"
body = {
"id": "123",
"name": "John Doe",
"age": 42
}
response = requests.request("POST", url, json = body, headers = {
"Content-Type": "application/json"
})
print(response.text){
"id": "123",
"name": "John Doe",
"age": 42
}