Aller au contenu
CADCAMFUN
Docs

Documentation

Outils

Enregistrements de coupe et dimensions utilisés par les flux de travail d'usinage des applications.

Traduit automatiquement de l'anglais. Voir l'original en anglais

Playground

Envoyez ces demandes à votre propre sidecar en cours d’exécution. Les valeurs restent dans ce navigateur.

Non connecté
Comment ça marche

Le sidecar écoute sur un port de bouclage choisi au démarrage et l'imprime dans son ready doubler; utilisez cette URL et le CADCAMFUN_TOKEN ça a commencé avec. Les demandes vont directement de cette page à cette adresse.

Le sidecar envoie les en-têtes CORS uniquement aux origines Tauri et à http://localhost ou http://127.0.0.1 sur n'importe quel port. À partir des documents hébergés, le navigateur bloque la réponse, exécutez donc les documents localement (bun run dev dans packages/web) pour utiliser le terrain de jeu, ou copiez la requête sous forme curl. Pour expérimenter sans toucher aux données réelles, démarrez le sidecar avec CADCAMFUN_DATA_DIR pointé vers un répertoire jetable — voir la procédure pas à pas de l'API.

Opérations

5 endpoints dans le tools groupe, généré à partir du propre sidecar Document OpenAPI. Les opérations protégées prennent Authorization: Bearer $CADCAMFUN_TOKEN; voir authentification. Le comportement et les limites sont en place le guide du sous-système.

obtenir /api/tools tools.list
poste /api/tools tools.create
obtenir /api/tools/{id} tools.get
mettre /api/tools/{id} tools.update
supprimer /api/tools/{id} tools.remove
Opérations sur les outils en 3D Faites glisser vers l'orbite · faites défiler pour zoomer · faites glisser vers la droite pour effectuer un panoramique
Un bloc par opération (5), empilé par section de ressources de cette page et coloré par méthode : vert GET, orange POST, bleu PUT, violet PATCH, rouge DELETE. Généré à partir du document OpenAPI au moment de la construction.

/api/tools

obtenir /api/tools # tools.list

Nécessite Authorization: Bearer <token>.

Paramètres
NomDansTaperRequis
taper requête chaîne | null facultatif
matériel requête chaîne | null facultatif
diamètre requête chaîne | null facultatif
recherche requête chaîne | null facultatif
publique requête chaîne | null facultatif
Réponses
200 Tableau<objet> 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
Exemple de réponse capturé · 200
OBTENIR /api/outils
[]
Exemple 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
OBTENIR /api/outils
curl --request GET "${CADCAMFUN_URL}/api/tools" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Essayez-le
poste /api/tools # tools.create

Nécessite Authorization: Bearer <token>.

Corps de la requête · requis · 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
}
Réponses
201 objet 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
Exemple 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
POST /api/outils
curl --request POST "${CADCAMFUN_URL}/api/tools" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Essayez-le
obtenir /api/tools/{id} # tools.get

Nécessite Authorization: Bearer <token>.

Paramètres
NomDansTaperRequis
identifiant chemin chaîne requis
Réponses
200 objet 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
Exemple 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
OBTENIR /api/tools/{id}
curl --request GET "${CADCAMFUN_URL}/api/tools/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Essayez-le
mettre /api/tools/{id} # tools.update

Nécessite Authorization: Bearer <token>.

Paramètres
NomDansTaperRequis
identifiant chemin chaîne requis
Corps de la requête · requis · 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
}
Réponses
200 objet 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
Exemple 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
METTRE /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
Essayez-le
supprimer /api/tools/{id} # tools.remove

Nécessite Authorization: Bearer <token>.

Paramètres
NomDansTaperRequis
identifiant chemin chaîne requis
Réponses
200 objet 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
Exemple 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
SUPPRIMER /api/tools/{id}
curl --request DELETE "${CADCAMFUN_URL}/api/tools/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Essayez-le

Schémas

Schémas nommés accessibles à partir des paramètres, des corps et des réponses de ce groupe. UN ? marque un champ facultatif ; | null marque un champ qui peut être présent avec une valeur nulle.

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
}

Appel à ce groupe

Les identifiants d'opération ont la forme tools.<name>. Le SDK Promise généré (@cadcamfun/api/sdk) expose la plupart d'entre eux comme client.<namespace>.<method>(input), où input est un objet plat composé de paramètres de chemin et de champs de corps ; L'exemple de SDK de chaque carte montre l'accesseur exact et le type d'entrée. Les téléchargements en plusieurs parties, les réponses binaires ou JavaScript et les webhooks bruts ne sont pas générés ; ces cartes montrent fetch à la place.

Erreurs du 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
  }
}

Dépannage

SymptômeCause probableRéparer
401 à chaque appelJeton d'un lancement précédent, ou manquant Bearer préfixeEnvoyer Authorization: Bearer <token> avec le jeton avec lequel le sidecar a été démarré.
400 avant que quoi que ce soit se produiseLe corps ou le paramètre ne correspond pas au schémaComparez la charge utile avec le schéma de demande sur la carte.
403 ou 404 sur un enregistrement visible ailleursLe compte intérimaire diffèreEnvoyez le droit x-session-token, ou utilisez le profil local propriétaire de l'enregistrement.
409État conflictuel, tel qu'un nom en double ou un chef de succursale obsolèteRelisez la ressource et réessayez avec les données actuelles.
Essayez, il est écrit "bloqué par CORS"Les documents sont servis à partir d'une origine sans bouclageExécutez la documentation localement ou copiez la demande en tant que curl.
Connexion rejetéeLe sidecar a redémarré sur un nouveau portLire le port du nouveau ready ligne.