Fumadocs

Create a user

Time to create a user account, eh?

POST
/user/signup

User to create

name?string
emailstring
Formatemail
passwordstring

Response Body

curl -X POST "https://galaxy.scalar.com/user/signup" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Marc",
    "email": "marc@scalar.com",
    "password": "i-love-scalar"
  }'
const body = JSON.stringify({
  "name": "Marc",
  "email": "marc@scalar.com",
  "password": "i-love-scalar"
})

fetch("https://galaxy.scalar.com/user/signup", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://galaxy.scalar.com/user/signup"
  body := strings.NewReader(`{
    "name": "Marc",
    "email": "marc@scalar.com",
    "password": "i-love-scalar"
  }`)
  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://galaxy.scalar.com/user/signup"
body = {
  "name": "Marc",
  "email": "marc@scalar.com",
  "password": "i-love-scalar"
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.time.Duration;
import java.net.http.HttpRequest.BodyPublishers;

var body = BodyPublishers.ofString("""{
  "name": "Marc",
  "email": "marc@scalar.com",
  "password": "i-love-scalar"
}""");
HttpClient client = HttpClient.newBuilder()
  .connectTimeout(Duration.ofSeconds(10))
  .build();

HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
  .uri(URI.create("https://galaxy.scalar.com/user/signup"))
  .header("Content-Type", "application/json")
  .POST(body)
  .build();

try {
  HttpResponse<String> response = client.send(requestBuilder.build(), BodyHandlers.ofString());
  System.out.println("Status code: " + response.statusCode());
  System.out.println("Response body: " + response.body());
} catch (Exception e) {
  e.printStackTrace();
}
using System;
using System.Net.Http;
using System.Text;

var body = new StringContent("""
{
  "name": "Marc",
  "email": "marc@scalar.com",
  "password": "i-love-scalar"
}
""", Encoding.UTF8, "application/json");

var client = new HttpClient();
var response = await client.PostAsync("https://galaxy.scalar.com/user/signup", body);
var responseBody = await response.Content.ReadAsStringAsync();
{
  "id": 1,
  "name": "Marc"
}
{
  "type": "https://example.com/errors/bad-request",
  "title": "Bad Request",
  "status": 400,
  "detail": "The request was invalid."
}
{
  "type": "https://example.com/errors/not-found",
  "title": "Unauthorized",
  "status": 401,
  "detail": "You are not authorized to access this resource."
}
{
  "type": "https://example.com/errors/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "You are not authorized to access this resource."
}
{
  "type": "https://example.com/errors/conflict",
  "title": "Conflict",
  "status": 409,
  "detail": "The resource you are trying to access is in conflict."
}
{
  "type": "https://example.com/errors/unprocessable-entity",
  "title": "Unprocessable Entity",
  "status": 422,
  "detail": "The request was invalid."
}

How is this guide?