Documentación
Espacio de trabajo
Dibujos de proyectos, componentes, trayectorias de herramientas, recursos de biblioteca y vistas previas limitadas de solo lectura para clientes complementarios.
Traducido automáticamente del inglés. Ver el original en inglés
Envíe estas solicitudes a su propio sidecar en funcionamiento. Los valores permanecen en este navegador.
¿Cómo funciona esto?
El sidecar escucha en un puerto loopback elegido al inicio y lo imprime en su ready línea; use esa URL y el CADCAMFUN_TOKEN se empezó con. Las solicitudes van directamente desde esta página a esa dirección.
El sidecar envía encabezados CORS solo a los orígenes Tauri y a http://localhost o http://127.0.0.1 en cualquier puerto. Desde los documentos alojados, el navegador bloquea la respuesta, así que ejecute los documentos localmente (bun run dev en packages/web) para usar el área de juegos o copiar la solicitud como curl. Para experimentar sin tocar datos reales, inicie el sidecar con CADCAMFUN_DATA_DIR apuntado a un directorio desechable - ver el tutorial de la API.
Operaciones
8 endpoints en el workspace grupo, generado a partir del propio sidecar Documento OpenAPI. Las operaciones protegidas toman Authorization: Bearer $CADCAMFUN_TOKEN; ver autenticación. El comportamiento y los límites están en la guía del subsistema.
| conseguir | /api/projects/{id}/workspace/drawings | workspace.drawings |
| conseguir | /api/projects/{id}/workspace/drawings/{drawingId}/preview | workspace.drawingPreview |
| conseguir | /api/projects/{id}/workspace/components | workspace.components |
| conseguir | /api/projects/{id}/workspace/components/{componentId}/preview | workspace.componentPreview |
| conseguir | /api/projects/{id}/workspace/toolpaths | workspace.toolpaths |
| conseguir | /api/projects/{id}/workspace/toolpaths/{toolpathId} | workspace.toolpath |
| conseguir | /api/projects/{id}/workspace/toolpaths/{toolpathId}/preview | workspace.toolpathPreview |
| conseguir | /api/projects/{id}/workspace/library | workspace.library |
/api/projects
workspace.drawings Requiere Authorization: Bearer <token>.
| Nombre | En | Tipo | Requerido |
|---|---|---|---|
| identificación | camino | cadena | requerido |
200 Matriz<objeto> application/json
Array<{ id: string name: string subtitle: string | null updatedAt: string }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
buscar ejemplo
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/drawings`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/drawings" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Pruébalo
workspace.drawingPreview Requiere Authorization: Bearer <token>.
| Nombre | En | Tipo | Requerido |
|---|---|---|---|
| identificación | camino | cadena | requerido |
| drawingId | camino | cadena | requerido |
200 objeto application/json
{ positions: Array<number | "Infinity" | "-Infinity" | "NaN"> indices: Array<number | "Infinity" | "-Infinity" | "NaN"> normals: Array<number | "Infinity" | "-Infinity" | "NaN"> bounds: { min: unknown[] max: unknown[] } parts: Array<{ id: string name: string triangleStart: number | "Infinity" | "-Infinity" | "NaN" triangleCount: number | "Infinity" | "-Infinity" | "NaN" }> truncated: boolean revision: string features?: Array<{ elementId: string name: string features: Array<{ id: string type: string parameters: Array<{ key: string value: string }> }> }> }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
buscar ejemplo
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/drawings/${drawingId}/preview`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/drawings/<drawingId>/preview" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Pruébalo
workspace.components Requiere Authorization: Bearer <token>.
| Nombre | En | Tipo | Requerido |
|---|---|---|---|
| identificación | camino | cadena | requerido |
200 Matriz<objeto> application/json
Array<{ id: string name: string subtitle: string | null updatedAt: string }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
buscar ejemplo
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/components`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/components" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Pruébalo
workspace.componentPreview Requiere Authorization: Bearer <token>.
| Nombre | En | Tipo | Requerido |
|---|---|---|---|
| identificación | camino | cadena | requerido |
| componentId | camino | cadena | requerido |
200 objeto application/json
{ positions: Array<number | "Infinity" | "-Infinity" | "NaN"> indices: Array<number | "Infinity" | "-Infinity" | "NaN"> normals: Array<number | "Infinity" | "-Infinity" | "NaN"> bounds: { min: unknown[] max: unknown[] } parts: Array<{ id: string name: string triangleStart: number | "Infinity" | "-Infinity" | "NaN" triangleCount: number | "Infinity" | "-Infinity" | "NaN" }> truncated: boolean revision: string features?: Array<{ elementId: string name: string features: Array<{ id: string type: string parameters: Array<{ key: string value: string }> }> }> parameters: Array<{ key: string value: string }> }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
buscar ejemplo
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/components/${componentId}/preview`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/components/<componentId>/preview" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Pruébalo
workspace.toolpaths Requiere Authorization: Bearer <token>.
| Nombre | En | Tipo | Requerido |
|---|---|---|---|
| identificación | camino | cadena | requerido |
200 Matriz<objeto> application/json
Array<{ id: string name: string subtitle: string | null updatedAt: string }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
buscar ejemplo
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/toolpaths`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/toolpaths" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Pruébalo
workspace.toolpath Requiere Authorization: Bearer <token>.
| Nombre | En | Tipo | Requerido |
|---|---|---|---|
| identificación | camino | cadena | requerido |
| toolpathId | camino | cadena | requerido |
200 objeto application/json
{ id: string name: string operationType: string | null gcode: string stats: { rapidMoves: number | "Infinity" | "-Infinity" | "NaN" linearMoves: number | "Infinity" | "-Infinity" | "NaN" circularMoves: number | "Infinity" | "-Infinity" | "NaN" machineFunctions: number | "Infinity" | "-Infinity" | "NaN" } revision: string updatedAt: string }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
buscar ejemplo
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/toolpaths/${toolpathId}`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/toolpaths/<toolpathId>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Pruébalo
workspace.toolpathPreview Requiere Authorization: Bearer <token>.
| Nombre | En | Tipo | Requerido |
|---|---|---|---|
| identificación | camino | cadena | requerido |
| toolpathId | camino | cadena | requerido |
200 objeto application/json
{ segments: Array<{ kind: "rapid" | "linear" | "circular" line: number | "Infinity" | "-Infinity" | "NaN" from: unknown[] to: unknown[] }> bounds: { min: unknown[] max: unknown[] } stock: { min: unknown[] max: unknown[] } truncated: boolean stats: { rapidMoves: number | "Infinity" | "-Infinity" | "NaN" linearMoves: number | "Infinity" | "-Infinity" | "NaN" circularMoves: number | "Infinity" | "-Infinity" | "NaN" machineFunctions: number | "Infinity" | "-Infinity" | "NaN" } machine?: { kind: "mill" | "lathe" | "3dprinter" source: "override" | "kernel" | "generator" | "inferred" | "settings" mismatch?: { inferred: "mill" | "lathe" | "3dprinter" reasons: string[] } axes: number | "Infinity" | "-Infinity" | "NaN" turns: string workholding: string assumed: Array<"workholding" | "table" | "stock"> xMode?: "diameter" | "radius" turret?: "rear" | "front" bodies: Array<{ id: string role: "stock" | "jaw" | "parallel" | "vise-base" | "clamp" | "table" | "chuck" | "collet" | "tailstock" | "bed" | "build-volume" shape: { type: "box" min: { x: number | "Infinity" | "-Infinity" | "NaN" y: number | "NaN" z: number | "NaN" } max: { x: number | "NaN" } } | { type: "cylinder-x" x0: number | "NaN" x1: number | "NaN" radius: number | "NaN" inner: number | "NaN" } | { type: "cone-x" x0: number | "NaN" r0: number | "NaN" r1: number rotateX?: number | "Infinity" | "-Infinity" | "NaN" spins: boolean assumed: boolean obstacle: boolean wire?: boolean }> spin: Array<{ segment: number | "Infinity" | "-Infinity" | "NaN" rate: number | "Infinity" | "-Infinity" | "NaN" }> collisions: Array<number | "Infinity" | "-Infinity" | "NaN"> operations?: Array<{ index: number | "Infinity" | "-Infinity" | "NaN" name: string toolId: string startSegment: number | "Infinity" | "-Infinity" | "NaN" endSegment: number | "Infinity" | "-Infinity" | "NaN" cutter?: { diameter: number | "Infinity" | "-Infinity" | "NaN" fluteLength: number | "Infinity" | "-Infinity" | "NaN" shankDiameter: number | "Infinity" | "-Infinity" | "NaN" stickout: number | "Infinity" | "-Infinity" | "NaN" noseRadius: number | "Infinity" | "-Infinity" | "NaN" holder: { diameter: number | "Infinity" | "-Infinity" | "NaN" length: number | "Infinity" | "-Infinity" | "NaN" kind: string assumed: boolean } } }> events?: Array<{ code: string severity: "error" | "warning" seconds: number | "Infinity" | "-Infinity" | "NaN" segment: number | "Infinity" | "-Infinity" | "NaN" line?: number | "Infinity" | "-Infinity" | "NaN" message: string }> tool: { family: "mill" | "lathe" | "nozzle" diameter: number | "Infinity" | "-Infinity" | "NaN" width: number | "Infinity" | "-Infinity" | "NaN" noseRadius: number | "Infinity" | "-Infinity" | "NaN" insert: string internal: boolean turret?: "rear" | "front" } } part?: { positions: Array<number | "Infinity" | "-Infinity" | "NaN"> indices: Array<number | "Infinity" | "-Infinity" | "NaN"> normals: Array<number | "Infinity" | "-Infinity" | "NaN"> bounds: { min: unknown[] max: unknown[] } parts: Array<{ id: string name: string triangleStart: number | "Infinity" | "-Infinity" | "NaN" triangleCount: number | "Infinity" | "-Infinity" | "NaN" }> truncated: boolean } revision: string }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
buscar ejemplo
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/toolpaths/${toolpathId}/preview`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/toolpaths/<toolpathId>/preview" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Pruébalo
workspace.library Requiere Authorization: Bearer <token>.
| Nombre | En | Tipo | Requerido |
|---|---|---|---|
| identificación | camino | cadena | requerido |
200 objeto application/json
{ materials: Array<{ id: string name: string subtitle: string | null updatedAt: string }> tools: Array<{ id: string name: string subtitle: string | null updatedAt: string }> machines: Array<{ id: string name: string subtitle: string | null updatedAt: string }> components: Array<{ id: string name: string subtitle: string | null updatedAt: string }> }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
buscar ejemplo
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/library`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/library" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Pruébalo
esquemas
Esquemas con nombre accesibles desde los parámetros, cuerpos y respuestas de este grupo. A ? marca un campo opcional; | null marca un campo que puede estar presente con un valor nulo.
BadRequestEncoded{ _tag: "BadRequest" message: string }
InternalErrorEncoded{ _tag: "InternalError" message: string }
NotFoundEncoded{ _tag: "NotFound" message: string }
Llamando a este grupo
Los identificadores de operación tienen la forma workspace.<name>. El SDK de promesa generado (@cadcamfun/api/sdk) expone la mayoría de ellos como client.<namespace>.<method>(input), dónde input es un objeto plano de parámetros de ruta y campos de cuerpo; El ejemplo de SDK de cada tarjeta muestra el acceso exacto y el tipo de entrada. No se generan cargas de varias partes, respuestas binarias o JavaScript ni webhooks sin formato; esas tarjetas muestran fetch en su lugar.
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
}
} Solución de problemas
| Síntoma | causa probable | Arreglar |
|---|---|---|
| 401 en cada llamada | Token de un lanzamiento anterior o faltante Bearer prefijo | Enviar Authorization: Bearer <token> con la ficha con la que se inició el sidecar. |
| 400 antes de que ocurra algo | El cuerpo o el parámetro no coincide con el esquema | Compare la carga útil con el esquema de solicitud en la tarjeta. |
| 403 o 404 en un registro que puedes ver en otro sitio | La cuenta de actuación difiere. | enviar la derecha x-session-tokeno utilice el perfil local propietario del registro. |
| 409 | Estado conflictivo, como un nombre duplicado o un encabezado de sucursal obsoleto | Vuelva a leer el recurso y vuelva a intentarlo con los datos actuales. |
| Pruébelo, dice "bloqueado por CORS" | Los documentos se entregan desde un origen sin bucle invertido. | Ejecute los documentos localmente o copie la solicitud como curl. |
| Conexión rechazada | El sidecar se reinició en un nuevo puerto. | Leer el puerto del nuevo ready línea. |