Zum Inhalt springen
CADCAMFUN
Doku

Dokumentation

Werkzeugwegverlauf

Werkzeugwegversionen, Wiederherstellung, Bibliothekserkennung und Thread-Programmkommentare.

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

8 Endpunkte in der toolpathExtras 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/toolpaths/library toolpathExtras.library
erhalten /api/toolpaths/{id}/versions toolpathExtras.listVersions
post /api/toolpaths/{id}/versions toolpathExtras.createVersion
post /api/toolpaths/{id}/versions/restore toolpathExtras.restoreVersion
erhalten /api/toolpaths/{id}/comments toolpathExtras.listComments
post /api/toolpaths/{id}/comments toolpathExtras.createComment
setzen /api/toolpaths/{id}/comments/{commentId} toolpathExtras.updateComment
löschen /api/toolpaths/{id}/comments/{commentId} toolpathExtras.removeComment
Werkzeugweg-Verlaufsvorgänge in 3D Zum Orbit ziehen · zum Zoomen scrollen · zum Schwenken mit der rechten Maustaste ziehen
Ein Block pro Vorgang (8), 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/toolpaths/library

erhalten /api/toolpaths/library # toolpathExtras.library

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
projectId abfrage zeichenfolge erforderlich
typ abfrage zeichenfolge | null optional
operationType abfrage zeichenfolge | null optional
kategorie abfrage zeichenfolge | null optional
suchen abfrage zeichenfolge | null optional
Antworten
200 Array<Objekt> application/json
Array<{
  id: string
  name: string
  description: string
  type: string
  operationType: string
  category: string
  tags: string[]
  data: unknown
  gcode: string
  projectId: string
}>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
toolpathExtras.library
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolpathExtrasLibraryInput
const result = await client.toolpathExtras.library({})
curl
GET /api/toolpaths/library
curl --request GET "${CADCAMFUN_URL}/api/toolpaths/library?projectId=<projectId>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus

/api/toolpaths

erhalten /api/toolpaths/{id}/versions # toolpathExtras.listVersions

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Antworten
200 Array<Objekt> application/json
Array<{
  id: string
  toolpathId: string
  data: unknown
  gcode: string | null
  changeMessage: string | null
  userId: string
  createdAt: string
  user: {
    name: string | null
    email: string | null
  } | null
}>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
toolpathExtras.listVersions
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolpathExtrasListVersionsInput
const result = await client.toolpathExtras.listVersions({
  id: "<id>"
})
curl
GET /api/toolpaths/{id}/versions
curl --request GET "${CADCAMFUN_URL}/api/toolpaths/<id>/versions" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
post /api/toolpaths/{id}/versions # toolpathExtras.createVersion

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Anforderungstext · erforderlich · application/json
{
  data?: unknown | null
  gcode?: string | null
  changeMessage?: string | null
}
Antworten
201 objekt application/json
{
  id: string
  toolpathId: string
  data: unknown
  gcode: string | null
  changeMessage: string | null
  userId: string
  createdAt: string
  message: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
toolpathExtras.createVersion
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolpathExtrasCreateVersionInput
const result = await client.toolpathExtras.createVersion({
  id: "<id>",
  data: null,
  gcode: "",
  changeMessage: ""
})
curl
POST /api/toolpaths/{id}/versions
curl --request POST "${CADCAMFUN_URL}/api/toolpaths/<id>/versions" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus
post /api/toolpaths/{id}/versions/restore # toolpathExtras.restoreVersion

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Anforderungstext · erforderlich · application/json
{
  versionId: string
}
Antworten
200 objekt application/json
{
  id: string
  name: string
  description: string | null
  data: unknown
  type: string | null
  operationType: string | null
  gcode: string | null
  thumbnail: string | null
  isPublic: boolean
  projectId: string
  createdAt: string
  updatedAt: string
  createdBy: string
  drawingId: string | null
  materialId: string | null
  toolId: string | null
  machineConfigId: string | null
  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
toolpathExtras.restoreVersion
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolpathExtrasRestoreVersionInput
const result = await client.toolpathExtras.restoreVersion({
  id: "<id>",
  versionId: ""
})
curl
POST /api/toolpaths/{id}/versions/restore
curl --request POST "${CADCAMFUN_URL}/api/toolpaths/<id>/versions/restore" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus
erhalten /api/toolpaths/{id}/comments # toolpathExtras.listComments

Erfordert Authorization: Bearer <token>.

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

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

// ToolpathExtrasListCommentsInput
const result = await client.toolpathExtras.listComments({
  id: "<id>"
})
curl
GET /api/toolpaths/{id}/comments
curl --request GET "${CADCAMFUN_URL}/api/toolpaths/<id>/comments" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Probieren Sie es aus
post /api/toolpaths/{id}/comments # toolpathExtras.createComment

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
Anforderungstext · erforderlich · application/json
{
  content: string
}
Antworten
201 objekt application/json
{
  id: string
  toolpathId: string
  content: string
  userId: string
  createdAt: string
  updatedAt: string
  user: {
    id: string
    name: string | null
    email: string | null
    image: string | null
  } | null
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK-Beispiel
toolpathExtras.createComment
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolpathExtrasCreateCommentInput
const result = await client.toolpathExtras.createComment({
  id: "<id>",
  content: ""
})
curl
POST /api/toolpaths/{id}/comments
curl --request POST "${CADCAMFUN_URL}/api/toolpaths/<id>/comments" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus
setzen /api/toolpaths/{id}/comments/{commentId} # toolpathExtras.updateComment

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
commentId weg zeichenfolge erforderlich
Anforderungstext · erforderlich · application/json
{
  content: string
}
Antworten
200 objekt application/json
{
  id: string
  toolpathId: string
  content: string
  userId: string
  createdAt: string
  updatedAt: string
  user: {
    id: string
    name: string | null
    email: string | null
    image: string | null
  } | null
}
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
toolpathExtras.updateComment
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolpathExtrasUpdateCommentInput
const result = await client.toolpathExtras.updateComment({
  id: "<id>",
  commentId: "<commentId>",
  content: ""
})
curl
PUT /api/toolpaths/{id}/comments/{commentId}
curl --request PUT "${CADCAMFUN_URL}/api/toolpaths/<id>/comments/<commentId>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Probieren Sie es aus
löschen /api/toolpaths/{id}/comments/{commentId} # toolpathExtras.removeComment

Erfordert Authorization: Bearer <token>.

Parameter
NameInTypErforderlich
ausweis weg zeichenfolge erforderlich
commentId 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
toolpathExtras.removeComment
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolpathExtrasRemoveCommentInput
const result = await client.toolpathExtras.removeComment({
  id: "<id>",
  commentId: "<commentId>"
})
curl
DELETE /api/toolpaths/{id}/comments/{commentId}
curl --request DELETE "${CADCAMFUN_URL}/api/toolpaths/<id>/comments/<commentId>" \
  --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
}
ForbiddenEncoded
{
  _tag: "Forbidden"
  message: string
}
InternalErrorEncoded
{
  _tag: "InternalError"
  message: string
}
NotFoundEncoded
{
  _tag: "NotFound"
  message: string
}
UnauthorizedEncoded
{
  _tag: "Unauthorized"
  message: string
}

Ich rufe diese Gruppe an

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