Zum Inhalt springen
CADCAMFUN
Doku

Dokumentation

Anwendungsdienste

Desktop-Integrationsrouten, verfolgte Projektabläufe, Benachrichtigungen und Push-Abonnement-Datensätze.

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

10 Endpunkte in der misc 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.

post /api/push-subscription misc.pushSubscribe
löschen /api/push-subscription misc.pushUnsubscribe
post /api/app-control/notify misc.notify
post /api/desktop/auth/signin misc.desktopSignin
erhalten /api/desktop/projects misc.desktopProjects
post /api/desktop/projects misc.desktopCreateProject
erhalten /api/desktop/user/by-email misc.desktopUserByEmail
erhalten /api/projects/tracked/{id} misc.trackedGet
setzen /api/projects/tracked/{id} misc.trackedUpdate
löschen /api/projects/tracked/{id} misc.trackedRemove
Anwendungsdienstvorgänge in 3D Zum Orbit ziehen · zum Zoomen scrollen · zum Schwenken mit der rechten Maustaste ziehen
Ein Block pro Vorgang (10), 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/push-subscription

post /api/push-subscription # misc.pushSubscribe

Erfordert Authorization: Bearer <token>.

Anforderungstext · erforderlich · application/json
{
  endpoint?: string | null
  keys?: {
    p256dh?: string | null
    auth?: string | null
  } | null
}
Antworten
200 objekt application/json
{
  success: true
  id: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
misc.pushSubscribe
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscPushSubscribeInput
const result = await client.misc.pushSubscribe({
  endpoint: "",
  keys: {}
})
curl
POST /api/push-subscription
curl --request POST "${CADCAMFUN_URL}/api/push-subscription" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus
löschen /api/push-subscription # misc.pushUnsubscribe

Erfordert Authorization: Bearer <token>.

Anforderungstext · erforderlich · application/json
{
  endpoint?: string | null
}
Antworten
200 objekt application/json
{
  success: true
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
misc.pushUnsubscribe
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscPushUnsubscribeInput
const result = await client.misc.pushUnsubscribe({
  endpoint: ""
})
curl
LÖSCHEN /api/push-subscription
curl --request DELETE "${CADCAMFUN_URL}/api/push-subscription" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus

/api/app-control/notify

post /api/app-control/notify # misc.notify

Erfordert Authorization: Bearer <token>.

Anforderungstext · erforderlich · application/json
{
  userId?: string | null
  message?: unknown | null
}
Antworten
200 objekt application/json
{
  success: true
  message: string
}
400 NotifyBadRequestEncoded application/json
NotifyBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 NotifyInternalEncoded application/json
NotifyInternalEncoded
SDK-Beispiel
misc.notify
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscNotifyInput
const result = await client.misc.notify({
  userId: "",
  message: null
})
curl
POST /api/app-control/notify
curl --request POST "${CADCAMFUN_URL}/api/app-control/notify" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus

/api/desktop/auth

post /api/desktop/auth/signin # misc.desktopSignin

Erfordert Authorization: Bearer <token>.

Anforderungstext · erforderlich · application/json
{
  email?: string | null
  password?: string | null
  deviceId?: string | null
  platform?: string | null
}
Antworten
200 objekt application/json
{
  success: true
  token: string
  user: {
    id: string
    name: string | null
    email: string | null
    image: string | null
  }
  syncData: {
    lastSync: string
    version: string
  }
}
400 DesktopBadRequestEncoded application/json
DesktopBadRequestEncoded
401 DesktopUnauthorizedEncoded | UnauthorizedEncoded application/json
DesktopUnauthorizedEncoded | UnauthorizedEncoded
500 DesktopInternalEncoded application/json
DesktopInternalEncoded
SDK-Beispiel
misc.desktopSignin
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscDesktopSigninInput
const result = await client.misc.desktopSignin({
  email: "",
  password: "",
  deviceId: "",
  platform: ""
})
curl
POST /api/desktop/auth/signin
curl --request POST "${CADCAMFUN_URL}/api/desktop/auth/signin" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus

/api/desktop/projects

erhalten /api/desktop/projects # misc.desktopProjects

Erfordert Authorization: Bearer <token>.

Antworten
200 objekt application/json
{
  success: true
  data: Array<{
    id: string
    name: string
    description: string | null
    owner_id: string
    organization_id: string | null
    is_public: boolean
    created_at: string
    updated_at: string
  }>
  message: string
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 DesktopInternalEncoded application/json
DesktopInternalEncoded
Beispielantwort erfasst · 200
GET /api/desktop/projects
{
  "success": true,
  "data": [],
  "message": "Retrieved 0 projects"
}
SDK-Beispiel
misc.desktopProjects
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.misc.desktopProjects()
curl
GET /api/desktop/projects
curl --request GET "${CADCAMFUN_URL}/api/desktop/projects" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
post /api/desktop/projects # misc.desktopCreateProject

Erfordert Authorization: Bearer <token>.

Anforderungstext · erforderlich · application/json
{
  name?: unknown | null
  description?: string | null
  organization_id?: string | null
  is_public?: boolean | null
}
Antworten
201 objekt application/json
{
  success: true
  data: {
    id: string
    name: string
    description: string | null
    owner_id: string
    organization_id: string | null
    is_public: boolean
    created_at: string
    updated_at: string
  }
  message: string
}
400 DesktopBadRequestEncoded application/json
DesktopBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
409 DesktopConflictEncoded application/json
DesktopConflictEncoded
500 DesktopInternalEncoded application/json
DesktopInternalEncoded
SDK-Beispiel
misc.desktopCreateProject
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscDesktopCreateProjectInput
const result = await client.misc.desktopCreateProject({
  name: null,
  description: "",
  organization_id: "",
  is_public: false
})
curl
POST /api/desktop/projects
curl --request POST "${CADCAMFUN_URL}/api/desktop/projects" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus

/api/desktop/user

erhalten /api/desktop/user/by-email # misc.desktopUserByEmail

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
e-Mail abfrage zeichenfolge | null optional
Antworten
200 objekt application/json
{
  success: true
  data: {
    id: string
    name: string | null
    email: string | null
    image: string | null
    created_at: string
    updated_at: string
  }
  message: string
}
400 DesktopBadRequestEncoded application/json
DesktopBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 DesktopNotFoundEncoded application/json
DesktopNotFoundEncoded
500 DesktopInternalEncoded application/json
DesktopInternalEncoded
Beispielantwort erfasst · 400
GET /api/desktop/user/by-email
{
  "_tag": "DesktopBadRequest",
  "success": false,
  "error": "Email parameter is required"
}
SDK-Beispiel
misc.desktopUserByEmail
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscDesktopUserByEmailInput
const result = await client.misc.desktopUserByEmail({})
curl
GET /api/desktop/user/by-email
curl --request GET "${CADCAMFUN_URL}/api/desktop/user/by-email" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus

/api/projects/tracked

erhalten /api/projects/tracked/{id} # misc.trackedGet

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Antworten
200 objekt application/json
{
  id: string
  name: string
  description: string | null
  createdAt: string
  updatedAt: string
  ownerId: string
  organizationId: string | null
  isPublic: boolean
  owner: {
    id: string
    name: string | null
    email: string | null
  }
  organization: {
    id: string
    name: string
  } | null
  _count: {
    drawings: number | "Infinity" | "-Infinity" | "NaN"
    components: number | "Infinity" | "-Infinity" | "NaN"
  }
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
misc.trackedGet
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscTrackedGetInput
const result = await client.misc.trackedGet({
  id: "<id>"
})
curl
GET /api/projects/tracked/{id}
curl --request GET "${CADCAMFUN_URL}/api/projects/tracked/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
setzen /api/projects/tracked/{id} # misc.trackedUpdate

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Anforderungstext · erforderlich · application/json
{
  name?: string | null
  description?: string | null
  organizationId?: string | null
}
Antworten
200 objekt application/json
{
  id: string
  name: string
  description: string | null
  createdAt: string
  updatedAt: string
  ownerId: string
  organizationId: string | null
  isPublic: boolean
  owner: {
    id: string
    name: string | null
    email: string | null
  }
  organization: {
    id: string
    name: string
  } | null
  _count: {
    drawings: number | "Infinity" | "-Infinity" | "NaN"
    components: number | "Infinity" | "-Infinity" | "NaN"
  }
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
misc.trackedUpdate
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscTrackedUpdateInput
const result = await client.misc.trackedUpdate({
  id: "<id>",
  name: "",
  description: "",
  organizationId: ""
})
curl
PUT /api/projects/tracked/{id}
curl --request PUT "${CADCAMFUN_URL}/api/projects/tracked/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus
löschen /api/projects/tracked/{id} # misc.trackedRemove

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Antworten
200 objekt application/json
{
  message: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
misc.trackedRemove
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscTrackedRemoveInput
const result = await client.misc.trackedRemove({
  id: "<id>"
})
curl
LÖSCHEN /api/projects/tracked/{id}
curl --request DELETE "${CADCAMFUN_URL}/api/projects/tracked/<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
}
DesktopBadRequestEncoded
{
  _tag: "DesktopBadRequest"
  success: false
  error: string
}
DesktopConflictEncoded
{
  _tag: "DesktopConflict"
  success: false
  error: string
}
DesktopInternalEncoded
{
  _tag: "DesktopInternal"
  success: false
  error: string
}
DesktopNotFoundEncoded
{
  _tag: "DesktopNotFound"
  success: false
  error: string
}
DesktopUnauthorizedEncoded
{
  _tag: "DesktopUnauthorized"
  success: false
  error: string
}
ForbiddenEncoded
{
  _tag: "Forbidden"
  message: string
}
InternalErrorEncoded
{
  _tag: "InternalError"
  message: string
}
NotFoundEncoded
{
  _tag: "NotFound"
  message: string
}
NotifyBadRequestEncoded
{
  _tag: "NotifyBadRequest"
  success: false
  error: string
}
NotifyInternalEncoded
{
  _tag: "NotifyInternal"
  success: false
  error: string
}
UnauthorizedEncoded
{
  _tag: "Unauthorized"
  message: string
}

Ich rufe diese Gruppe an

Vorgangs-IDs haben die Form misc.<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.