Vai al contenuto
CADCAMFUN
Documentazione

Documentazione

Utensili

Registrazioni e dimensioni della taglierina utilizzate dai flussi di lavoro di lavorazione dell'applicazione.

Tradotto automaticamente dall'inglese. Vedi l'originale in inglese

Playground

Invia queste richieste al tuo sidecar in corsa. I valori rimangono in questo browser.

Non connesso
Come funziona

Il sidecar resta in ascolto su una porta di loopback scelta all'avvio e la stampa nel suo file ready linea; usa quell'URL e il file CADCAMFUN_TOKEN è stato iniziato con. Le richieste vanno direttamente da questa pagina a quell'indirizzo.

Il sidecar invia intestazioni CORS solo alle origini Tauri e a http://localhost o http://127.0.0.1 su qualsiasi porto. Dai documenti ospitati il browser blocca la risposta, quindi esegui i documenti localmente (bun run dev in packages/web) per utilizzare il parco giochi, oppure copiare la richiesta come ricciolo. Per sperimentare senza toccare i dati reali, avvia il sidecar con CADCAMFUN_DATA_DIR indicato in una directory usa e getta - vedi la procedura dettagliata dell'API.

Operazioni

5 endpoint nel tools gruppo, generato da quello del sidecar Documento OpenAPI. Le operazioni protette richiedono Authorization: Bearer $CADCAMFUN_TOKEN; vedere autenticazione. Comportamenti e limiti sono entrati la guida del sottosistema.

ottenere /api/tools tools.list
inviare /api/tools tools.create
ottenere /api/tools/{id} tools.get
mettere /api/tools/{id} tools.update
eliminare /api/tools/{id} tools.remove
Operazioni sugli strumenti in 3D Trascina per orbitare · scorri per ingrandire · trascina con il tasto destro per eseguire la panoramica
Un blocco per operazione (5), impilato per sezione di risorse di questa pagina e colorato in base al metodo: verde GET, arancione POST, blu PUT, viola PATCH, rosso DELETE. Generato dal documento OpenAPI in fase di compilazione.

/api/tools

ottenere /api/tools # tools.list

Richiede Authorization: Bearer <token>.

Parametri
NomeInTipoNecessario
tipo domanda corda | null opzionale
materiale domanda corda | null opzionale
diametro domanda corda | null opzionale
ricerca domanda corda | null opzionale
pubblico domanda corda | null opzionale
Risposte
200 Matrice<oggetto> 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
Risposta di esempio catturato · 200
OTTIENI /api/tools
[]
Esempio dell'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
OTTIENI /api/tools
curl --request GET "${CADCAMFUN_URL}/api/tools" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Provalo
inviare /api/tools # tools.create

Richiede Authorization: Bearer <token>.

Corpo della richiesta · obbligatorio · application/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
}
Risposte
201 oggetto 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
Esempio dell'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
POST /api/strumenti
curl --request POST "${CADCAMFUN_URL}/api/tools" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Provalo
ottenere /api/tools/{id} # tools.get

Richiede Authorization: Bearer <token>.

Parametri
NomeInTipoNecessario
id sentiero corda necessario
Risposte
200 oggetto 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
Esempio dell'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
OTTIENI /api/tools/{id}
curl --request GET "${CADCAMFUN_URL}/api/tools/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Provalo
mettere /api/tools/{id} # tools.update

Richiede Authorization: Bearer <token>.

Parametri
NomeInTipoNecessario
id sentiero corda necessario
Corpo della richiesta · obbligatorio · application/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
}
Risposte
200 oggetto 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
Esempio dell'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/tools/{id}
curl --request PUT "${CADCAMFUN_URL}/api/tools/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Provalo
eliminare /api/tools/{id} # tools.remove

Richiede Authorization: Bearer <token>.

Parametri
NomeInTipoNecessario
id sentiero corda necessario
Risposte
200 oggetto 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
Esempio dell'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
ELIMINA /api/tools/{id}
curl --request DELETE "${CADCAMFUN_URL}/api/tools/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Provalo

Schemi

Schemi denominati raggiungibili dai parametri, dai corpi e dalle risposte di questo gruppo. UN ? contrassegna un campo facoltativo; | null contrassegna un campo che può essere presente con un valore nullo.

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
}

Chiamando questo gruppo

Gli ID operazione hanno il formato tools.<name>. L'SDK Promise generato (@cadcamfun/api/sdk) ne espone la maggior parte come client.<namespace>.<method>(input), dove input è un oggetto piatto di parametri di percorso e campi del corpo; l'esempio dell'SDK di ciascuna scheda mostra l'esatto accessor e il tipo di input. Non vengono generati caricamenti in più parti, risposte binarie o JavaScript e webhook grezzi; quelle carte mostrano fetch invece.

Errori dall'SDK 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
  }
}

Risoluzione dei problemi

SintomoProbabile causaAggiustare
401 a ogni chiamataToken di un lancio precedente o mancante Bearer prefissoInviare Authorization: Bearer <token> con il gettone con cui è stato avviato il sidecar.
400 prima che accada qualcosaIl corpo o il parametro non corrisponde allo schemaConfronta il payload con lo schema di richiesta sulla carta.
403 o 404 su un record visibile altroveIl resoconto della recitazione è diversoInvia il diritto x-session-tokenoppure utilizzare il profilo locale proprietario del record.
409Stato in conflitto, ad esempio un nome duplicato o una testa di ramo obsoletaRileggere la risorsa e riprovare con i dati correnti.
Prova, dice "bloccato da CORS"I documenti vengono serviti da un'origine non di loopbackEsegui i documenti localmente o copia la richiesta come curl.
Connessione rifiutataIl sidecar è ripartito su una nuova portaLeggi il porto dal nuovo ready riga.