Documentación
Herramientas
Registros de corte y dimensiones utilizados por los flujos de trabajo de mecanizado de aplicaciones.
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
5 endpoints en el tools 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/tools | tools.list |
| correo | /api/tools | tools.create |
| conseguir | /api/tools/{id} | tools.get |
| poner | /api/tools/{id} | tools.update |
| borrar | /api/tools/{id} | tools.remove |
/api/tools
tools.list Requiere Authorization: Bearer <token>.
| Nombre | En | Tipo | Requerido |
|---|---|---|---|
| tipo | consulta | cadena | null | opcional |
| material | consulta | cadena | null | opcional |
| diámetro | consulta | cadena | null | opcional |
| buscar | consulta | cadena | null | opcional |
| público | consulta | cadena | null | opcional |
200 Matriz<objeto> application/json
Array<{ id: string name: string type: string diameter: number | "Infinity" | "-Infinity" | "NaN" material: string numberOfFlutes: number | "Infinity" | "-Infinity" | "NaN" | null maxRPM: number | "Infinity" | "-Infinity" | "NaN" | null coolantType: string | null cuttingLength: number | "Infinity" | "-Infinity" | "NaN" | null totalLength: number | "Infinity" | "-Infinity" | "NaN" | null shankDiameter: number | "Infinity" | "-Infinity" | "NaN" | null cornerRadius?: number | "Infinity" | "-Infinity" | "NaN" | null tipAngle?: number | "Infinity" | "-Infinity" | "NaN" | null threadPitch?: number | "Infinity" | "-Infinity" | "NaN" | null holderDiameter?: number | "Infinity" | "-Infinity" | "NaN" | null holderLength?: number | "Infinity" | "-Infinity" | "NaN" | null stickout?: number | "Infinity" | "-Infinity" | "NaN" | null notes: string | null isPublic: boolean createdAt: string updatedAt: string ownerId: string | null organizationId: string | null }>
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
Ejemplo de respuesta capturado · 200
[] Ejemplo de SDK
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// ToolsListInput
const result = await client.tools.list({}) curl
curl --request GET "${CADCAMFUN_URL}/api/tools" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Pruébalo
tools.create Requiere Authorization: Bearer <token>.
{ name?: string | null type?: string | null diameter?: number | "Infinity" | "-Infinity" | "NaN" | null material?: string | null numberOfFlutes?: number | "Infinity" | "-Infinity" | "NaN" | null maxRPM?: number | "Infinity" | "-Infinity" | "NaN" | null coolantType?: string | null cuttingLength?: number | "Infinity" | "-Infinity" | "NaN" | null totalLength?: number | "Infinity" | "-Infinity" | "NaN" | null shankDiameter?: number | "Infinity" | "-Infinity" | "NaN" | null cornerRadius?: number | "Infinity" | "-Infinity" | "NaN" | null tipAngle?: number | "Infinity" | "-Infinity" | "NaN" | null threadPitch?: number | "Infinity" | "-Infinity" | "NaN" | null holderDiameter?: number | "Infinity" | "-Infinity" | "NaN" | null holderLength?: number | "Infinity" | "-Infinity" | "NaN" | null stickout?: number | "Infinity" | "-Infinity" | "NaN" | null notes?: string | null organizationId?: string | null isPublic?: boolean | null }
201 objeto application/json
{ id: string name: string type: string diameter: number | "Infinity" | "-Infinity" | "NaN" material: string numberOfFlutes: number | "Infinity" | "-Infinity" | "NaN" | null maxRPM: number | "Infinity" | "-Infinity" | "NaN" | null coolantType: string | null cuttingLength: number | "Infinity" | "-Infinity" | "NaN" | null totalLength: number | "Infinity" | "-Infinity" | "NaN" | null shankDiameter: number | "Infinity" | "-Infinity" | "NaN" | null cornerRadius?: number | "Infinity" | "-Infinity" | "NaN" | null tipAngle?: number | "Infinity" | "-Infinity" | "NaN" | null threadPitch?: number | "Infinity" | "-Infinity" | "NaN" | null holderDiameter?: number | "Infinity" | "-Infinity" | "NaN" | null holderLength?: number | "Infinity" | "-Infinity" | "NaN" | null stickout?: number | "Infinity" | "-Infinity" | "NaN" | null notes: string | null isPublic: boolean createdAt: string updatedAt: string ownerId: string | null organizationId: string | null }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
Ejemplo de SDK
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// ToolsCreateInput
const result = await client.tools.create({
name: "",
type: "",
diameter: 0,
material: "",
numberOfFlutes: 0,
maxRPM: 0,
coolantType: "",
cuttingLength: 0,
totalLength: 0,
shankDiameter: 0,
cornerRadius: 0,
tipAngle: 0,
threadPitch: 0,
holderDiameter: 0,
holderLength: 0,
stickout: 0,
notes: "",
organizationId: "",
isPublic: false
}) curl
curl --request POST "${CADCAMFUN_URL}/api/tools" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json Pruébalo
tools.get Requiere Authorization: Bearer <token>.
| Nombre | En | Tipo | Requerido |
|---|---|---|---|
| identificación | camino | cadena | requerido |
200 objeto application/json
{ id: string name: string type: string diameter: number | "Infinity" | "-Infinity" | "NaN" material: string numberOfFlutes: number | "Infinity" | "-Infinity" | "NaN" | null maxRPM: number | "Infinity" | "-Infinity" | "NaN" | null coolantType: string | null cuttingLength: number | "Infinity" | "-Infinity" | "NaN" | null totalLength: number | "Infinity" | "-Infinity" | "NaN" | null shankDiameter: number | "Infinity" | "-Infinity" | "NaN" | null cornerRadius?: number | "Infinity" | "-Infinity" | "NaN" | null tipAngle?: number | "Infinity" | "-Infinity" | "NaN" | null threadPitch?: number | "Infinity" | "-Infinity" | "NaN" | null holderDiameter?: number | "Infinity" | "-Infinity" | "NaN" | null holderLength?: number | "Infinity" | "-Infinity" | "NaN" | null stickout?: number | "Infinity" | "-Infinity" | "NaN" | null notes: string | null isPublic: boolean createdAt: string updatedAt: string ownerId: string | null organizationId: string | null owner: { id: string name: string | null email: string | null } | null organization: { id: string name: string } | null }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
Ejemplo de SDK
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// ToolsGetInput
const result = await client.tools.get({
id: "<id>"
}) curl
curl --request GET "${CADCAMFUN_URL}/api/tools/<id>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Pruébalo
tools.update Requiere Authorization: Bearer <token>.
| Nombre | En | Tipo | Requerido |
|---|---|---|---|
| identificación | camino | cadena | requerido |
{ name?: string | null type?: string | null diameter?: number | "Infinity" | "-Infinity" | "NaN" | null material?: string | null numberOfFlutes?: number | "Infinity" | "-Infinity" | "NaN" | null maxRPM?: number | "Infinity" | "-Infinity" | "NaN" | null coolantType?: string | null cuttingLength?: number | "Infinity" | "-Infinity" | "NaN" | null totalLength?: number | "Infinity" | "-Infinity" | "NaN" | null shankDiameter?: number | "Infinity" | "-Infinity" | "NaN" | null cornerRadius?: number | "Infinity" | "-Infinity" | "NaN" | null tipAngle?: number | "Infinity" | "-Infinity" | "NaN" | null threadPitch?: number | "Infinity" | "-Infinity" | "NaN" | null holderDiameter?: number | "Infinity" | "-Infinity" | "NaN" | null holderLength?: number | "Infinity" | "-Infinity" | "NaN" | null stickout?: number | "Infinity" | "-Infinity" | "NaN" | null notes?: string | null organizationId?: string | null isPublic?: boolean | null }
200 objeto application/json
{ id: string name: string type: string diameter: number | "Infinity" | "-Infinity" | "NaN" material: string numberOfFlutes: number | "Infinity" | "-Infinity" | "NaN" | null maxRPM: number | "Infinity" | "-Infinity" | "NaN" | null coolantType: string | null cuttingLength: number | "Infinity" | "-Infinity" | "NaN" | null totalLength: number | "Infinity" | "-Infinity" | "NaN" | null shankDiameter: number | "Infinity" | "-Infinity" | "NaN" | null cornerRadius?: number | "Infinity" | "-Infinity" | "NaN" | null tipAngle?: number | "Infinity" | "-Infinity" | "NaN" | null threadPitch?: number | "Infinity" | "-Infinity" | "NaN" | null holderDiameter?: number | "Infinity" | "-Infinity" | "NaN" | null holderLength?: number | "Infinity" | "-Infinity" | "NaN" | null stickout?: number | "Infinity" | "-Infinity" | "NaN" | null notes: string | null isPublic: boolean createdAt: string updatedAt: string ownerId: string | null organizationId: string | 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
Ejemplo de SDK
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// ToolsUpdateInput
const result = await client.tools.update({
id: "<id>",
name: "",
type: "",
diameter: 0,
material: "",
numberOfFlutes: 0,
maxRPM: 0,
coolantType: "",
cuttingLength: 0,
totalLength: 0,
shankDiameter: 0,
cornerRadius: 0,
tipAngle: 0,
threadPitch: 0,
holderDiameter: 0,
holderLength: 0,
stickout: 0,
notes: "",
organizationId: "",
isPublic: false
}) curl
curl --request PUT "${CADCAMFUN_URL}/api/tools/<id>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json Pruébalo
tools.remove Requiere Authorization: Bearer <token>.
| Nombre | En | Tipo | Requerido |
|---|---|---|---|
| identificación | camino | cadena | requerido |
200 objeto 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
Ejemplo de SDK
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// ToolsRemoveInput
const result = await client.tools.remove({
id: "<id>"
}) curl
curl --request DELETE "${CADCAMFUN_URL}/api/tools/<id>" \
--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 }
ForbiddenEncoded{ _tag: "Forbidden" message: string }
InternalErrorEncoded{ _tag: "InternalError" message: string }
NotFoundEncoded{ _tag: "NotFound" message: string }
Llamando a este grupo
Los identificadores de operación tienen la forma tools.<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. |