Saltar al contenido
CADCAMFUN
Documentos

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

Área de pruebas

Envíe estas solicitudes a su propio sidecar en funcionamiento. Los valores permanecen en este navegador.

No conectado
¿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
Operaciones de herramientas en 3D Arrastrar para orbitar · desplazarse para hacer zoom · arrastrar con el botón derecho para desplazarse
Un bloque por operación (5), apilado por sección de recursos de esta página y coloreado por método: GET verde, POST naranja, PUT azul, PATCH violeta, DELETE rojo. Generado a partir del documento OpenAPI en el momento de la compilación.

/api/tools

conseguir /api/tools # tools.list

Requiere Authorization: Bearer <token>.

Parámetros
NombreEnTipoRequerido
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
Respuestas
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
OBTENER /api/herramientas
[]
Ejemplo de SDK
tools.list
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
OBTENER /api/herramientas
curl --request GET "${CADCAMFUN_URL}/api/tools" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Pruébalo
correo /api/tools # tools.create

Requiere Authorization: Bearer <token>.

Cuerpo de la solicitud · requerido · aplicación/json
{
  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
}
Respuestas
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
tools.create
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
ENVIAR /api/herramientas
curl --request POST "${CADCAMFUN_URL}/api/tools" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Pruébalo
conseguir /api/tools/{id} # tools.get

Requiere Authorization: Bearer <token>.

Parámetros
NombreEnTipoRequerido
identificación camino cadena requerido
Respuestas
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
tools.get
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
OBTENER /api/tools/{id}
curl --request GET "${CADCAMFUN_URL}/api/tools/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Pruébalo
poner /api/tools/{id} # tools.update

Requiere Authorization: Bearer <token>.

Parámetros
NombreEnTipoRequerido
identificación camino cadena requerido
Cuerpo de la solicitud · requerido · aplicación/json
{
  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
}
Respuestas
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
tools.update
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
PUT /api/herramientas/{id}
curl --request PUT "${CADCAMFUN_URL}/api/tools/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Pruébalo
borrar /api/tools/{id} # tools.remove

Requiere Authorization: Bearer <token>.

Parámetros
NombreEnTipoRequerido
identificación camino cadena requerido
Respuestas
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
tools.remove
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
ELIMINAR /api/tools/{id}
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
}
UnauthorizedEncoded
{
  _tag: "Unauthorized"
  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.

Errores del SDK de Promise
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íntomacausa probableArreglar
401 en cada llamadaToken de un lanzamiento anterior o faltante Bearer prefijoEnviar Authorization: Bearer <token> con la ficha con la que se inició el sidecar.
400 antes de que ocurra algoEl cuerpo o el parámetro no coincide con el esquemaCompare la carga útil con el esquema de solicitud en la tarjeta.
403 o 404 en un registro que puedes ver en otro sitioLa cuenta de actuación difiere.enviar la derecha x-session-tokeno utilice el perfil local propietario del registro.
409Estado conflictivo, como un nombre duplicado o un encabezado de sucursal obsoletoVuelva 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 rechazadaEl sidecar se reinició en un nuevo puerto.Leer el puerto del nuevo ready línea.