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
Envoyez ces demandes à votre propre sidecar en cours d’exécution. Les valeurs restent dans ce navigateur.
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 |
/api/tools
tools.list Nécessite Authorization: Bearer <token>.
| Nom | Dans | Taper | Requis |
|---|---|---|---|
| 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 |
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
[] Exemple 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}" Essayez-le
tools.create Nécessite 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 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
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 Essayez-le
tools.get Nécessite Authorization: Bearer <token>.
| Nom | Dans | Taper | Requis |
|---|---|---|---|
| identifiant | chemin | chaîne | requis |
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
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}" Essayez-le
tools.update Nécessite Authorization: Bearer <token>.
| Nom | Dans | Taper | Requis |
|---|---|---|---|
| identifiant | chemin | chaîne | requis |
{ 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 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
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 Essayez-le
tools.remove Nécessite Authorization: Bearer <token>.
| Nom | Dans | Taper | Requis |
|---|---|---|---|
| identifiant | chemin | chaîne | requis |
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
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}" 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 }
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.
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ôme | Cause probable | Réparer |
|---|---|---|
| 401 à chaque appel | Jeton d'un lancement précédent, ou manquant Bearer préfixe | Envoyer Authorization: Bearer <token> avec le jeton avec lequel le sidecar a été démarré. |
| 400 avant que quoi que ce soit se produise | Le corps ou le paramètre ne correspond pas au schéma | Comparez la charge utile avec le schéma de demande sur la carte. |
| 403 ou 404 sur un enregistrement visible ailleurs | Le compte intérimaire diffère | Envoyez 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ète | Relisez 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 bouclage | Exécutez la documentation localement ou copiez la demande en tant que curl. |
| Connexion rejetée | Le sidecar a redémarré sur un nouveau port | Lire le port du nouveau ready ligne. |