Zum Inhalt springen
CADCAMFUN
Doku

Dokumentation

Benutzer

Profile, Kontoressourcen, API-Schlüssel, Token-Datensätze, Passwörter und Kontoentfernung.

Automatisch aus dem Englischen übersetzt. Englisches Original ansehen

Playground

Senden Sie diese Anfragen an Ihren eigenen laufenden Sidecar. Werte bleiben in diesem Browser.

Nicht verbunden
Wie das funktioniert

Der Sidecar lauscht an einem beim Start ausgewählten Loopback-Port und gibt ihn dort aus ready linie; Verwenden Sie diese URL und die CADCAMFUN_TOKEN es wurde damit begonnen. Anfragen gehen direkt von dieser Seite an diese Adresse.

Der Sidecar sendet CORS-Header nur an die Tauri-Ursprünge und an http://localhost oder http://127.0.0.1 auf jedem Port. Von den gehosteten Dokumenten aus blockiert der Browser die Antwort, also führen Sie die Dokumente lokal aus (bun run dev in packages/web), um den Spielplatz zu nutzen, oder kopieren Sie die Anfrage als Curl. Um zu experimentieren, ohne echte Daten zu berühren, starten Sie den Sidecar mit CADCAMFUN_DATA_DIR zeigte auf ein Wegwerfverzeichnis – siehe die API-Komplettlösung.

Operationen

18 Endpunkte in der user gruppe, generiert aus der eigenen Gruppe des Sidecars OpenAPI-Dokument. Geschützte Operationen dauern Authorization: Bearer $CADCAMFUN_TOKEN; sehen authentifizierung. Verhalten und Grenzen sind in das Subsystemhandbuch.

erhalten /api/user/profile user.profile
setzen /api/user/profile user.updateProfile
erhalten /api/user/stats user.stats
erhalten /api/user/components user.components
erhalten /api/user/projects user.projects
erhalten /api/user/toolpaths user.toolpaths
erhalten /api/user/organizations user.organizations
erhalten /api/user/api-keys user.apiKeys
post /api/user/api-keys user.createApiKey
löschen /api/user/api-keys user.revokeApiKey
löschen /api/user/delete-account user.deleteAccount
setzen /api/user/password user.password
erhalten /api/user/tokens user.tokens
post /api/user/tokens user.createToken
erhalten /api/user/verify-change user.verifyChange
erhalten /api/user/git-profile user.gitProfile
setzen /api/user/git-profile user.updateGitProfile
erhalten /api/user/{id} user.byId
Benutzervorgänge in 3D Zum Orbit ziehen · zum Zoomen scrollen · zum Schwenken mit der rechten Maustaste ziehen
Ein Block pro Vorgang (18), gestapelt pro Ressourcenabschnitt dieser Seite und nach Methode gefärbt: grün GET, orange POST, blau PUT, violett PATCH, rot DELETE. Wird zur Erstellungszeit aus dem OpenAPI-Dokument generiert.

/api/user/profile

erhalten /api/user/profile # user.profile

Erfordert Authorization: Bearer <token>.

Antworten
200 objekt application/json
{
  id: string
  name: string | null
  email: string | null
  image: string | null
  bio: string | null
  location: string | null
  website: string | null
  company: string | null
  title: string | null
  publicProfile: boolean
  showEmail: boolean
  createdAt: string
  _count: {
    projects: number | "Infinity" | "-Infinity" | "NaN"
  }
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
Beispielantwort erfasst · 200
GET /api/user/profile
{
  "id": "c942817d-0162-4291-84ff-77321d387acc",
  "name": "Local user",
  "email": "local@cadcamfun.local",
  "image": null,
  "bio": null,
  "location": null,
  "website": null,
  "company": null,
  "title": null,
  "publicProfile": true,
  "showEmail": false,
  "createdAt": "2026-10-15T04:52:06.538Z",
  "_count": {
    "projects": 0
  }
}
SDK-Beispiel
user.profile
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.profile()
curl
GET /api/user/profile
curl --request GET "${CADCAMFUN_URL}/api/user/profile" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
setzen /api/user/profile # user.updateProfile

Erfordert Authorization: Bearer <token>.

Anforderungstext · erforderlich · mehrteilige/Formulardaten
{
  name?: string | null
  bio?: string | null
  location?: string | null
  website?: string | null
  company?: string | null
  title?: string | null
  publicProfile?: string | null
  showEmail?: string | null
  profileImage?: string[] | null
}
Antworten
200 objekt application/json
{
  message: string
  user: {
    id: string
    name: string | null
    email: string | null
    image: string | null
    bio: string | null
    location: string | null
    website: string | null
    company: string | null
    title: string | null
    publicProfile: boolean
    showEmail: boolean
    updatedAt: string
  }
  name: string | null
  email: string | null
  image: string | null
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
beispiel abrufen
user.updateProfile
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/user/profile`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
PUT /api/user/profile
curl --request PUT "${CADCAMFUN_URL}/api/user/profile" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: multipart/form-data" \
  --data-binary @request-body
Probieren Sie es aus

Für diesen Vorgang werden Multipart-/Formulardaten benötigt. Verwenden Sie das Curl- oder Fetch-Beispiel.

/api/user/stats

erhalten /api/user/stats # user.stats

Erfordert Authorization: Bearer <token>.

Antworten
200 objekt application/json
{
  projectsCount: number | "Infinity" | "-Infinity" | "NaN"
  drawingsCount: number | "Infinity" | "-Infinity" | "NaN"
  toolpathsCount: number | "Infinity" | "-Infinity" | "NaN"
  componentsCount: number | "Infinity" | "-Infinity" | "NaN"
  totalDesigns: number | "Infinity" | "-Infinity" | "NaN"
  memberSince: string
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 KeyedInternalEncoded application/json
KeyedInternalEncoded
Beispielantwort erfasst · 200
GET /api/user/stats
{
  "projectsCount": 0,
  "drawingsCount": 0,
  "toolpathsCount": 0,
  "componentsCount": 0,
  "totalDesigns": 0,
  "memberSince": "2026-10-15T04:52:06.538Z"
}
SDK-Beispiel
user.stats
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.stats()
curl
GET /api/user/stats
curl --request GET "${CADCAMFUN_URL}/api/user/stats" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus

/api/user/components

erhalten /api/user/components # user.components

Erfordert Authorization: Bearer <token>.

Antworten
200 Array<Objekt> application/json
Array<{
  id: string
  name: string
  description: string | null
  createdAt: string
  updatedAt: string
  thumbnail: string | null
  projectId: string | null
}>
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
Beispielantwort erfasst · 200
GET /api/user/components
[]
SDK-Beispiel
user.components
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.components()
curl
GET /api/user/components
curl --request GET "${CADCAMFUN_URL}/api/user/components" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus

/api/user/projects

erhalten /api/user/projects # user.projects

Erfordert Authorization: Bearer <token>.

Antworten
200 Array<Objekt> application/json
Array<{
  id: string
  name: string
  description: string | null
  createdAt: string
  updatedAt: string
}>
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
Beispielantwort erfasst · 200
GET /api/user/projects
[]
SDK-Beispiel
user.projects
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.projects()
curl
GET /api/user/projects
curl --request GET "${CADCAMFUN_URL}/api/user/projects" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus

/api/user/toolpaths

erhalten /api/user/toolpaths # user.toolpaths

Erfordert Authorization: Bearer <token>.

Antworten
200 Array<Objekt> application/json
Array<{
  id: string
  name: string
  description: string | null
  createdAt: string
  updatedAt: string
  thumbnail: string | null
  projectId: string | null
}>
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
Beispielantwort erfasst · 200
GET /api/user/toolpaths
[]
SDK-Beispiel
user.toolpaths
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.toolpaths()
curl
GET /api/user/toolpaths
curl --request GET "${CADCAMFUN_URL}/api/user/toolpaths" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus

/api/user/organizations

erhalten /api/user/organizations # user.organizations

Erfordert Authorization: Bearer <token>.

Antworten
200 Array<Objekt> application/json
Array<{
  id: string
  name: string
  description: string | null
  createdAt: string
  updatedAt: string
  role: string
  userCount: number | "Infinity" | "-Infinity" | "NaN"
  projectCount: number | "Infinity" | "-Infinity" | "NaN"
}>
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
Beispielantwort erfasst · 200
GET /api/user/organizations
[]
SDK-Beispiel
user.organizations
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.organizations()
curl
GET /api/user/organizations
curl --request GET "${CADCAMFUN_URL}/api/user/organizations" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus

/api/user/api-keys

erhalten /api/user/api-keys # user.apiKeys

Erfordert Authorization: Bearer <token>.

Antworten
200 Array<Objekt> application/json
Array<{
  id: string
  name: string
  createdAt: string
  lastUsed: string | null
  expiresAt: string | null
}>
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
Beispielantwort erfasst · 200
GET /api/user/api-keys
[]
SDK-Beispiel
user.apiKeys
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.apiKeys()
curl
GET /api/user/api-keys
curl --request GET "${CADCAMFUN_URL}/api/user/api-keys" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
post /api/user/api-keys # user.createApiKey

Erfordert Authorization: Bearer <token>.

Anforderungstext · erforderlich · application/json
{
  name?: unknown | null
}
Antworten
201 objekt application/json
{
  message: string
  apiKey: string
  name: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
user.createApiKey
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// UserCreateApiKeyInput
const result = await client.user.createApiKey({
  name: null
})
curl
POST /api/user/api-keys
curl --request POST "${CADCAMFUN_URL}/api/user/api-keys" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus
löschen /api/user/api-keys # user.revokeApiKey

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
keyId abfrage zeichenfolge | null optional
Antworten
200 objekt application/json
{
  message: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
user.revokeApiKey
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// UserRevokeApiKeyInput
const result = await client.user.revokeApiKey({})
curl
LÖSCHEN /api/user/api-keys
curl --request DELETE "${CADCAMFUN_URL}/api/user/api-keys" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus

/api/user/delete-account

löschen /api/user/delete-account # user.deleteAccount

Erfordert Authorization: Bearer <token>.

Antworten
200 objekt application/json
{
  message: string
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
user.deleteAccount
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.deleteAccount()
curl
DELETE /api/user/delete-account
curl --request DELETE "${CADCAMFUN_URL}/api/user/delete-account" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus

/api/user/password

setzen /api/user/password # user.password

Erfordert Authorization: Bearer <token>.

Anforderungstext · erforderlich · application/json
{
  currentPassword?: string | null
  newPassword?: string | null
}
Antworten
200 objekt application/json
{
  message: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
user.password
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// UserPasswordInput
const result = await client.user.password({
  currentPassword: "",
  newPassword: ""
})
curl
PUT /api/user/password
curl --request PUT "${CADCAMFUN_URL}/api/user/password" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus

/api/user/tokens

erhalten /api/user/tokens # user.tokens

Erfordert Authorization: Bearer <token>.

Antworten
200 objekt application/json
{
  tokens: Array<{
    id: string
    name: string
    prefix: string
    permissions: string[]
    createdAt: string
    lastUsed?: string | null
    expiresAt?: string | null
    isActive: boolean
  }>
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 KeyedInternalEncoded application/json
KeyedInternalEncoded
Beispielantwort erfasst · 200
GET /api/user/tokens
{
  "tokens": [
    {
      "id": "token-1",
      "name": "Development Token",
      "prefix": "cad_dev_abc123",
      "permissions": [
        "read:projects",
        "write:drawings",
        "read:toolpaths"
      ],
      "createdAt": "2026-10-08T04:52:23.364Z",
      "lastUsed": "2026-10-15T03:52:23.364Z",
      "isActive": true
    },
    {
      "id": "token-2",
      "name": "Mobile App Token",
      "prefix": "cad_mobile_xyz789",
      "permissions": [
        "read:projects",
        "write:toolpaths"
      ],
      "createdAt": "2026-10-01T04:52:23.364Z",
      "lastUsed": "2026-10-15T01:52:23.364Z",
      "expiresAt": "2026-11-14T04:52:23.364Z",
      "isActive": true
    },
    {
      "id": "token-3",
      "name": "Analytics Integration",
      "prefix": "cad_analytics_def456",
      "permissions": [
        "read:analytics",
        "read:usage"
      ],
      "createdAt": "2026-09-24T04:52:23.364Z",
      "expiresAt": "2026-10-14T04:52:23.364Z",
      "isActive": false
    }
  ]
}
SDK-Beispiel
user.tokens
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.tokens()
curl
GET /api/user/tokens
curl --request GET "${CADCAMFUN_URL}/api/user/tokens" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
post /api/user/tokens # user.createToken

Erfordert Authorization: Bearer <token>.

Anforderungstext · erforderlich · application/json
{
  name?: string | null
  permissions?: unknown | null
  expiresIn?: number | "Infinity" | "-Infinity" | "NaN" | null
}
Antworten
201 objekt application/json
{
  token: {
    id: string
    name: string
    prefix: string
    permissions: string[]
    createdAt: string
    lastUsed?: string | null
    expiresAt?: string | null
    isActive: boolean
  }
  fullToken: string
}
400 TokenBadRequestEncoded application/json
TokenBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 KeyedInternalEncoded application/json
KeyedInternalEncoded
SDK-Beispiel
user.createToken
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// UserCreateTokenInput
const result = await client.user.createToken({
  name: "",
  permissions: null,
  expiresIn: 0
})
curl
POST /api/user/tokens
curl --request POST "${CADCAMFUN_URL}/api/user/tokens" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus

/api/user/verify-change

erhalten /api/user/verify-change # user.verifyChange

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
token abfrage zeichenfolge | null optional
typ abfrage zeichenfolge | null optional
passwort abfrage zeichenfolge | null optional
Antworten
200 objekt application/json
{
  message: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
Beispielantwort erfasst · 400
GET /api/user/verify-change
{
  "_tag": "BadRequest",
  "message": "Token and verification type are required"
}
SDK-Beispiel
user.verifyChange
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// UserVerifyChangeInput
const result = await client.user.verifyChange({})
curl
GET /api/user/verify-change
curl --request GET "${CADCAMFUN_URL}/api/user/verify-change" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus

/api/user/git-profile

erhalten /api/user/git-profile # user.gitProfile

Erfordert Authorization: Bearer <token>.

Antworten
200 objekt application/json
{
  name: string
  email: string
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
beispiel abrufen
user.gitProfile
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/user/git-profile`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
GET /api/user/git-profile
curl --request GET "${CADCAMFUN_URL}/api/user/git-profile" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
setzen /api/user/git-profile # user.updateGitProfile

Erfordert Authorization: Bearer <token>.

Anforderungstext · erforderlich · application/json
{
  name: string
  email: string
}
Antworten
200 objekt application/json
{
  name: string
  email: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
beispiel abrufen
user.updateGitProfile
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/user/git-profile`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
PUT /api/user/git-profile
curl --request PUT "${CADCAMFUN_URL}/api/user/git-profile" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus

/api/user

erhalten /api/user/{id} # user.byId

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Antworten
200 objekt application/json
{
  id: string
  name: string | null
  email: string | null
  image: string | null
  createdAt: string
  organizations: Array<{
    id: string
    name: string
    role: string
  }>
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
user.byId
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// UserByIdInput
const result = await client.user.byId({
  id: "<id>"
})
curl
GET /api/user/{id}
curl --request GET "${CADCAMFUN_URL}/api/user/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus

Schemata

Benannte Schemata, die über die Parameter, Körper und Antworten dieser Gruppe erreichbar sind. A ? markiert ein optionales Feld; | null markiert ein Feld, das möglicherweise mit einem Nullwert vorhanden ist.

BadRequestEncoded
{
  _tag: "BadRequest"
  message: string
}
InternalErrorEncoded
{
  _tag: "InternalError"
  message: string
}
KeyedInternalEncoded
{
  _tag: "KeyedInternal"
  error: string
}
NotFoundEncoded
{
  _tag: "NotFound"
  message: string
}
TokenBadRequestEncoded
{
  _tag: "TokenBadRequest"
  error: string
}
UnauthorizedEncoded
{
  _tag: "Unauthorized"
  message: string
}

Ich rufe diese Gruppe an

Vorgangs-IDs haben die Form user.<name>. Das generierte Promise SDK (@cadcamfun/api/sdk) entlarvt die meisten von ihnen als client.<namespace>.<method>(input), wo input ist ein flaches Objekt aus Pfadparametern und Körperfeldern; Das SDK-Beispiel jeder Karte zeigt den genauen Zugriffs- und Eingabetyp. Mehrteilige Uploads, Binär- oder JavaScript-Antworten und unformatierte Webhooks werden nicht generiert; Diese Karten zeigen fetch stattdessen.

Fehler vom Promise SDK
import { CadCam, ClientError } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

try {
  await client.projects.list()
} catch (error) {
  if (error instanceof ClientError) {
    // Transport | UnexpectedStatus | UnsupportedContentType | MalformedResponse | SseEventTooLarge
  } else {
    // a declared error body: switch on error._tag
  }
}

Fehlerbehebung

SymptomWahrscheinliche UrsacheFix
401 bei jedem AufrufToken von einem früheren Start oder fehlt Bearer präfixSchicken Authorization: Bearer <token> mit dem Token wurde der Sidecar gestartet.
400 bevor etwas passiertText oder Parameter stimmen nicht mit dem Schema übereinVergleichen Sie die Nutzlast mit dem Anforderungsschema auf der Karte.
403 oder 404 bei einem Datensatz, den du woanders siehstDas amtierende Konto ist unterschiedlichSchicken Sie das Richtige x-session-token, oder verwenden Sie das lokale Profil, das Eigentümer des Datensatzes ist.
409Widersprüchlicher Status, z. B. ein doppelter Name oder ein veralteter ZweigkopfLesen Sie die Ressource erneut und versuchen Sie es erneut mit den aktuellen Daten.
Versuchen Sie es mit der Meldung „Von CORS blockiert“.Die Dokumente werden von einem Nicht-Loopback-Ursprung bereitgestelltFühren Sie die Dokumente lokal aus oder kopieren Sie die Anfrage als Curl.
Verbindung abgelehntDer Sidecar wurde an einem neuen Port neu gestartetLesen Sie den Port neu ready Zeile.