दस्तावेज़
कार्यस्थान
सहयोगी ग्राहकों के लिए केवल पढ़ने योग्य प्रोजेक्ट चित्र, घटक, टूलपाथ, लाइब्रेरी संसाधन और सीमित पूर्वावलोकन।
स्वचालित अनुवाद अभी उपलब्ध नहीं है; पाठ अंग्रेज़ी में है और इंटरफ़ेस आपकी भाषा में है। अंग्रेज़ी मूल देखें
इन अनुरोधों को अपने स्वयं के चल रहे साइडकार को भेजें। मान इस ब्राउज़र में रहते हैं.
यह कैसे काम करता है
साइडकार स्टार्टअप पर चुने गए लूपबैक पोर्ट पर सुनता है और इसे प्रिंट करता है ready रेखा; उस यूआरएल का उपयोग करें और CADCAMFUN_TOKEN इसकी शुरुआत की गई थी. अनुरोध सीधे इस पृष्ठ से उस पते पर जाते हैं।
साइडकार CORS हेडर को केवल टौरी मूल और तक भेजता है http://localhost या http://127.0.0.1 किसी भी बंदरगाह पर. होस्ट किए गए दस्तावेज़ों से ब्राउज़र प्रतिक्रिया को अवरुद्ध कर देता है, इसलिए दस्तावेज़ों को स्थानीय रूप से चलाएँ (bun run dev में packages/web) खेल के मैदान का उपयोग करने के लिए, या अनुरोध को कर्ल के रूप में कॉपी करें। वास्तविक डेटा को छुए बिना प्रयोग करने के लिए, साइडकार से शुरुआत करें CADCAMFUN_DATA_DIR एक बेकार निर्देशिका की ओर इशारा किया - देखें एपीआई वॉकथ्रू.
संचालन
8 एंडपॉइंट workspace समूह, साइडकार के स्वयं से उत्पन्न ओपनएपीआई दस्तावेज़. संरक्षित संचालन लेते हैं Authorization: Bearer $CADCAMFUN_TOKEN; देखना प्रमाणीकरण. व्यवहार और मर्यादा में हैं सबसिस्टम गाइड.
| पाना | /api/projects/{id}/workspace/drawings | workspace.drawings |
| पाना | /api/projects/{id}/workspace/drawings/{drawingId}/preview | workspace.drawingPreview |
| पाना | /api/projects/{id}/workspace/components | workspace.components |
| पाना | /api/projects/{id}/workspace/components/{componentId}/preview | workspace.componentPreview |
| पाना | /api/projects/{id}/workspace/toolpaths | workspace.toolpaths |
| पाना | /api/projects/{id}/workspace/toolpaths/{toolpathId} | workspace.toolpath |
| पाना | /api/projects/{id}/workspace/toolpaths/{toolpathId}/preview | workspace.toolpathPreview |
| पाना | /api/projects/{id}/workspace/library | workspace.library |
/api/projects
workspace.drawings आवश्यक है Authorization: Bearer <token>.
| नाम | में | प्रकार | आवश्यक |
|---|---|---|---|
| पहचान | पथ | डोरी | आवश्यक |
200 सारणी<ऑब्जेक्ट> application/json
Array<{ id: string name: string subtitle: string | null updatedAt: string }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
उदाहरण लाओ
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/drawings`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/drawings" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" इसे अजमाएं
workspace.drawingPreview आवश्यक है Authorization: Bearer <token>.
| नाम | में | प्रकार | आवश्यक |
|---|---|---|---|
| पहचान | पथ | डोरी | आवश्यक |
| drawingId | पथ | डोरी | आवश्यक |
200 वस्तु application/json
{ positions: Array<number | "Infinity" | "-Infinity" | "NaN"> indices: Array<number | "Infinity" | "-Infinity" | "NaN"> normals: Array<number | "Infinity" | "-Infinity" | "NaN"> bounds: { min: unknown[] max: unknown[] } parts: Array<{ id: string name: string triangleStart: number | "Infinity" | "-Infinity" | "NaN" triangleCount: number | "Infinity" | "-Infinity" | "NaN" }> truncated: boolean revision: string features?: Array<{ elementId: string name: string features: Array<{ id: string type: string parameters: Array<{ key: string value: string }> }> }> }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
उदाहरण लाओ
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/drawings/${drawingId}/preview`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/drawings/<drawingId>/preview" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" इसे अजमाएं
workspace.components आवश्यक है Authorization: Bearer <token>.
| नाम | में | प्रकार | आवश्यक |
|---|---|---|---|
| पहचान | पथ | डोरी | आवश्यक |
200 सारणी<ऑब्जेक्ट> application/json
Array<{ id: string name: string subtitle: string | null updatedAt: string }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
उदाहरण लाओ
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/components`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/components" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" इसे अजमाएं
workspace.componentPreview आवश्यक है Authorization: Bearer <token>.
| नाम | में | प्रकार | आवश्यक |
|---|---|---|---|
| पहचान | पथ | डोरी | आवश्यक |
| componentId | पथ | डोरी | आवश्यक |
200 वस्तु application/json
{ positions: Array<number | "Infinity" | "-Infinity" | "NaN"> indices: Array<number | "Infinity" | "-Infinity" | "NaN"> normals: Array<number | "Infinity" | "-Infinity" | "NaN"> bounds: { min: unknown[] max: unknown[] } parts: Array<{ id: string name: string triangleStart: number | "Infinity" | "-Infinity" | "NaN" triangleCount: number | "Infinity" | "-Infinity" | "NaN" }> truncated: boolean revision: string features?: Array<{ elementId: string name: string features: Array<{ id: string type: string parameters: Array<{ key: string value: string }> }> }> parameters: Array<{ key: string value: string }> }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
उदाहरण लाओ
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/components/${componentId}/preview`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/components/<componentId>/preview" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" इसे अजमाएं
workspace.toolpaths आवश्यक है Authorization: Bearer <token>.
| नाम | में | प्रकार | आवश्यक |
|---|---|---|---|
| पहचान | पथ | डोरी | आवश्यक |
200 सारणी<ऑब्जेक्ट> application/json
Array<{ id: string name: string subtitle: string | null updatedAt: string }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
उदाहरण लाओ
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/toolpaths`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/toolpaths" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" इसे अजमाएं
workspace.toolpath आवश्यक है Authorization: Bearer <token>.
| नाम | में | प्रकार | आवश्यक |
|---|---|---|---|
| पहचान | पथ | डोरी | आवश्यक |
| toolpathId | पथ | डोरी | आवश्यक |
200 वस्तु application/json
{ id: string name: string operationType: string | null gcode: string stats: { rapidMoves: number | "Infinity" | "-Infinity" | "NaN" linearMoves: number | "Infinity" | "-Infinity" | "NaN" circularMoves: number | "Infinity" | "-Infinity" | "NaN" machineFunctions: number | "Infinity" | "-Infinity" | "NaN" } revision: string updatedAt: string }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
उदाहरण लाओ
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/toolpaths/${toolpathId}`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/toolpaths/<toolpathId>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" इसे अजमाएं
workspace.toolpathPreview आवश्यक है Authorization: Bearer <token>.
| नाम | में | प्रकार | आवश्यक |
|---|---|---|---|
| पहचान | पथ | डोरी | आवश्यक |
| toolpathId | पथ | डोरी | आवश्यक |
200 वस्तु application/json
{ segments: Array<{ kind: "rapid" | "linear" | "circular" line: number | "Infinity" | "-Infinity" | "NaN" from: unknown[] to: unknown[] }> bounds: { min: unknown[] max: unknown[] } stock: { min: unknown[] max: unknown[] } truncated: boolean stats: { rapidMoves: number | "Infinity" | "-Infinity" | "NaN" linearMoves: number | "Infinity" | "-Infinity" | "NaN" circularMoves: number | "Infinity" | "-Infinity" | "NaN" machineFunctions: number | "Infinity" | "-Infinity" | "NaN" } machine?: { kind: "mill" | "lathe" | "3dprinter" source: "override" | "kernel" | "generator" | "inferred" | "settings" mismatch?: { inferred: "mill" | "lathe" | "3dprinter" reasons: string[] } axes: number | "Infinity" | "-Infinity" | "NaN" turns: string workholding: string assumed: Array<"workholding" | "table" | "stock"> xMode?: "diameter" | "radius" turret?: "rear" | "front" bodies: Array<{ id: string role: "stock" | "jaw" | "parallel" | "vise-base" | "clamp" | "table" | "chuck" | "collet" | "tailstock" | "bed" | "build-volume" shape: { type: "box" min: { x: number | "Infinity" | "-Infinity" | "NaN" y: number | "NaN" z: number | "NaN" } max: { x: number | "NaN" } } | { type: "cylinder-x" x0: number | "NaN" x1: number | "NaN" radius: number | "NaN" inner: number | "NaN" } | { type: "cone-x" x0: number | "NaN" r0: number | "NaN" r1: number rotateX?: number | "Infinity" | "-Infinity" | "NaN" spins: boolean assumed: boolean obstacle: boolean wire?: boolean }> spin: Array<{ segment: number | "Infinity" | "-Infinity" | "NaN" rate: number | "Infinity" | "-Infinity" | "NaN" }> collisions: Array<number | "Infinity" | "-Infinity" | "NaN"> operations?: Array<{ index: number | "Infinity" | "-Infinity" | "NaN" name: string toolId: string startSegment: number | "Infinity" | "-Infinity" | "NaN" endSegment: number | "Infinity" | "-Infinity" | "NaN" cutter?: { diameter: number | "Infinity" | "-Infinity" | "NaN" fluteLength: number | "Infinity" | "-Infinity" | "NaN" shankDiameter: number | "Infinity" | "-Infinity" | "NaN" stickout: number | "Infinity" | "-Infinity" | "NaN" noseRadius: number | "Infinity" | "-Infinity" | "NaN" holder: { diameter: number | "Infinity" | "-Infinity" | "NaN" length: number | "Infinity" | "-Infinity" | "NaN" kind: string assumed: boolean } } }> events?: Array<{ code: string severity: "error" | "warning" seconds: number | "Infinity" | "-Infinity" | "NaN" segment: number | "Infinity" | "-Infinity" | "NaN" line?: number | "Infinity" | "-Infinity" | "NaN" message: string }> tool: { family: "mill" | "lathe" | "nozzle" diameter: number | "Infinity" | "-Infinity" | "NaN" width: number | "Infinity" | "-Infinity" | "NaN" noseRadius: number | "Infinity" | "-Infinity" | "NaN" insert: string internal: boolean turret?: "rear" | "front" } } part?: { positions: Array<number | "Infinity" | "-Infinity" | "NaN"> indices: Array<number | "Infinity" | "-Infinity" | "NaN"> normals: Array<number | "Infinity" | "-Infinity" | "NaN"> bounds: { min: unknown[] max: unknown[] } parts: Array<{ id: string name: string triangleStart: number | "Infinity" | "-Infinity" | "NaN" triangleCount: number | "Infinity" | "-Infinity" | "NaN" }> truncated: boolean } revision: string }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
उदाहरण लाओ
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/toolpaths/${toolpathId}/preview`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/toolpaths/<toolpathId>/preview" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" इसे अजमाएं
workspace.library आवश्यक है Authorization: Bearer <token>.
| नाम | में | प्रकार | आवश्यक |
|---|---|---|---|
| पहचान | पथ | डोरी | आवश्यक |
200 वस्तु application/json
{ materials: Array<{ id: string name: string subtitle: string | null updatedAt: string }> tools: Array<{ id: string name: string subtitle: string | null updatedAt: string }> machines: Array<{ id: string name: string subtitle: string | null updatedAt: string }> components: Array<{ id: string name: string subtitle: string | null updatedAt: string }> }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
उदाहरण लाओ
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/library`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/library" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" इसे अजमाएं
स्कीमा
नामित स्कीमा इस समूह के मापदंडों, निकायों और प्रतिक्रियाओं से पहुंच योग्य हैं। ए ? एक वैकल्पिक फ़ील्ड चिह्नित करता है; | null उस फ़ील्ड को चिह्नित करता है जो शून्य मान के साथ मौजूद हो सकता है।
BadRequestEncoded{ _tag: "BadRequest" message: string }
InternalErrorEncoded{ _tag: "InternalError" message: string }
NotFoundEncoded{ _tag: "NotFound" message: string }
इस समूह को कॉल किया जा रहा है
ऑपरेशन आईडी का फॉर्म है workspace.<name>. जनरेट किया गया प्रॉमिस SDK (@cadcamfun/api/sdk) उनमें से अधिकांश को इस रूप में उजागर करता है client.<namespace>.<method>(input), कहाँ input पथ पैरामीटर और बॉडी फ़ील्ड की एक सपाट वस्तु है; प्रत्येक कार्ड का एसडीके उदाहरण सटीक एक्सेसर और इनपुट प्रकार दिखाता है। मल्टीपार्ट अपलोड, बाइनरी या जावास्क्रिप्ट प्रतिक्रियाएँ और कच्चे वेबहुक उत्पन्न नहीं होते हैं; वे कार्ड दिखाते हैं fetch इसके बजाय.
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
}
} समस्या निवारण
| लक्षण | संभावित कारण | हल करना |
|---|---|---|
| हर कॉल पर 401 | पिछले लॉन्च से टोकन, या गायब Bearer उपसर्ग | भेजना Authorization: Bearer <token> टोकन के साथ साइडकार की शुरुआत की गई। |
| कुछ होने से पहले 400 | बॉडी या पैरामीटर स्कीमा से मेल नहीं खाता | कार्ड पर अनुरोध स्कीमा के साथ पेलोड की तुलना करें। |
| कहीं और दिखने वाले रिकॉर्ड पर 403 या 404 | एक्टिंग अकाउंट अलग है | सही भेजो x-session-token, या उस स्थानीय प्रोफ़ाइल का उपयोग करें जो रिकॉर्ड का स्वामी है। |
| 409 | विरोधाभासी स्थिति, जैसे डुप्लिकेट नाम या पुराना शाखा प्रमुख | संसाधन को दोबारा पढ़ें और वर्तमान डेटा के साथ पुनः प्रयास करें। |
| कोशिश करें यह कहता है "सीओआरएस द्वारा अवरुद्ध" | दस्तावेज़ गैर-लूपबैक मूल से परोसे जाते हैं | दस्तावेज़ों को स्थानीय रूप से चलाएँ या अनुरोध को कर्ल के रूप में कॉपी करें। |
| कनेक्शन नहीं हो सका | साइडकार एक नए बंदरगाह पर फिर से शुरू हुई | नए से पोर्ट पढ़ें ready पंक्ति. |