FileAPI

Start Part Analysis Report creation (xlsx) (GET)

Set up table of results of AM analysis.

Return Data
"Celery worker for storing analysis result file started."
Errors
PreconditionStatus codeError message
Part with <part_id> exists in database404Object not found in database.
User is owner of part, or part is owned by user of the same organization.403Access forbidden.

Fetch Part Analysis Report (xlsx) (PUT)

Fetch the analysis results file from minio.

Return Data
Fileresponse: analysis_results_file_temp.xlsx
Errors
PreconditionStatus codeError message
Part with <part_id> exists in database404Object not found in database.
User is owner of part, or part is owned by user of the same organization.403Access forbidden.
Analysis Report is set up404Object not found in storage.
Usage
# Connect Websocket ws://localhost/wss://platform.3dspark.de:80/ws/echo/?Bearer=<BearerToken>
let websocketInstance = new WebSocket(url + "/echo/?Bearer=" + this.$keycloak.token);
# Add Websocket handler
websocketInstance.onmessage = function(event){
  let json_event = JSON.parse(event.data);
  let task = json_event["task"];
  if(task=="write_and_store_analysis_results_XLS"){
    #fetch Part Analysis Report
    axiosInstance
      .get("/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/fetch-analysis-results-file/", {
        responseType: "blob",
      })
      .then((response) => {
        let fileName = "Results_" + this.part.name.replace(/\s/g, "_") + ".xlsx";
        saveAs(response.data, fileName);
      })
  }
}

# GET "https://platform.3dspark.de/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/analysis-results-file/"
this.axiosInstance
  .get("/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/analysis-results-file/")
  .then((response) => {
    console.log(response.data);
  })

Get VisualizationFile (.glb) (GET)

Fetch the visualization file from Minio or return Http404

Return Data
Fileresponse: MyFile_visual.glb
Errors
PreconditionStatus codeError message
Part with <part_id> exists in database404Object not found in database.
User is owner of part, or part is owned by user of the same organization.403Access forbidden.
Visualization file is in storage.404Object not found in storage.
Usage
# GET "https://platform.3dspark.de/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/visualization-file/"

#fetch Part visualization file
axiosInstance
  .get("/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/visualization-file/", {
    responseType: "blob",
  })
  .then((response) => {
    let fileName = "Results_" + this.part.name.replace(/\s/g, "_") + ".glb";
    saveAs(response.data, fileName);
  })

Get ThumbnailFile (.png) (GET)

Fetch the thumbnail file from Minio or return Http404

Return Data
Fileresponse: MyFile_thumbnail.png
Errors
PreconditionStatus codeError message
Part with <part_id> exists in database404Object not found in database.
User is owner of part, or part is owned by user of the same organization.403Access forbidden.
Thumbnail file is in storage.404Object not found in storage.
Usage
# GET "https://platform.3dspark.de/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/thumbnail-file/"

#fetch part thumbnail file
axiosInstance
  .get("/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/thumbnail-file/", {
    responseType: "blob",
  })
  .then((response) => {
    let fileName = "Results_" + this.part.name.replace(/\s/g, "_") + ".png";
    saveAs(response.data, fileName);
  })

Get CadFile (.stl | .stp | .step) (GET)

Fetch the cad file from Minio or return Http404

Return Data
Fileresponse: MyFile.step
Errors
PreconditionStatus codeError message
Part with <part_id> exists in database404Object not found in database.
User is owner of part, or part is owned by user of the same organization.403Access forbidden.
Cad file is in storage.404Object not found in storage.
Usage
# GET "https://platform.3dspark.de/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/upload-file/"

#fetch part CAD file
axiosInstance
  .get("/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/upload-file/", {
    responseType: "blob",
  })
  .then((response) => {
    let fileName = "MyCad_" + this.part.name.replace(/\s/g, "_") + ".step";
    saveAs(response.data, fileName);
  })

Delete Part (DELETE)

Delete CAD and all associated files and reset part status and attributes

Return Data
"CAD and associated files were deleted."
Errors
PreconditionStatus codeError message
Part with <part_id> exists in database404Object not found in database.
User is owner of part, or part is owned by other user of the same organization of which this user is manager or admin of.403Access forbidden.
Usage
# DELETE "https://platform.3dspark.de/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/upload-file/"

#delete all Part files and reset part status
axiosInstance
  .delete("/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/upload-file/")
  .then((response) => {
    console.log(response);
  })

Create oriented CAD-file (GET)

Starts celery task, which generates the oriented CAD file and stores it in minio.

Return Data
"Celery worker for storing oriented CAD started."
Errors
PreconditionStatus codeError message
Part with <part_id> exists in database404Object not found in database.
User is owner of part, or part is owned by user of the same organization.403Access forbidden.
CAD file is in storage.404Object not found in storage.
CAD file format is stl or stp.415Only STL and STP files allowed at the moment.

Fetch oriented CAD-file (GET)

Fetches the oriented Part from minio.

Return Data
Fileresponse: optimal_orientation_cad_file_temp.stp
Errors
PreconditionStatus codeError message
Part with <part_id> exists in database404Object not found in database.
User is owner of part, or part is owned by user of the same organization.403Access forbidden.
Oriented CAD file is in storage.404Object not found in storage.
Usage
# Connect Websocket ws://localhost/wss://platform.3dspark.de:80/ws/echo/?Bearer=<BearerToken>
let websocketInstance = new WebSocket(url + "/echo/?Bearer=" + this.$keycloak.token);
# Add Websocket handler
websocketInstance.onmessage = function(event){
  let json_event = JSON.parse(event.data);
  let task = json_event["task"];
  if(task=="apply_optimal_orientation_and_store_file_STEP"){
    #fetch Part Analysis Report
    axiosInstance
      .get("/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/fetch-optimal-orientation-file/", {
        responseType: "blob",
      })
      .then((response) => {
        let fileName = "Optimally_oriented_" + this.part.basename.replace(/\s/g, "_");
        saveAs(response.data, fileName);
      })
  }
}

# GET "https://platform.3dspark.de/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/optimal-orientation-file/"
this.axiosInstance
  .get("/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/optimal-orientation-file/")
  .then((response) => {
    console.log(response.data);
  })

Fetch Rfq Zip Cad and Drawings (.zip) (GET)

Download all stored files important to manufacturers (CAD + Drawings) for Request for Quotation mail.

Return Data
Fileresponse: MyFiles.zip
Errors
PreconditionStatus codeError message
Part with <part_id> exists in database404Object not found in database.
User is owner of part, or part is owned by user of the same organization.403Access forbidden.
Usage

Prepare Sending Rfq Mail (GET)

Set up predefined mail body for request for quotation to appropriate manufacturers.

Return Data


MailTo: <list of suppliers>
Subject: Request for Quotation - MyPart

**** DON'T FORGET TO ATTACH THE AUTOMATICALLY DOWNLOADED ZIP CONTAINING DRAWINGS AND CADs! **** 


Dear Sir or Madam,

we kindly request you to submit your quotation for the attached part with the following specifications:

Part name: MyPart.stl
Quantity: 1
Material: PLA
Machine: Ultimaker S5

Thank you in advance.

Kind regards,
Ahmad Khalidi


The content of this message is confidential. If you have received it by mistake, please inform us by an email reply and then delete the message. It is forbidden to copy, forward, or in any way reveal the contents of this message to anyone. The integrity and security of this email cannot be guaranteed over the Internet.
Gesendet von Mail für Windows
Errors
PreconditionStatus codeError message
Part with <part_id> exists in database404Object not found in database.
User is owner of part, or part is owned by user of the same organization.403Access forbidden.
Usage
# GET "https://platform.3dspark.de/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/zip-request-for-quotation/"

#fetch zip request for quotation
axiosInstance
  .get("/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/zip-request-for-quotation/", {
    responseType: "blob",
  })
  .then((response) => {
    let fileName = this.part.name.replace(/\s/g, "_") + "_data_for_RFQ.zip";
    saveAs(response.data, fileName);
  })


# GET "https://platform.3dspark.de/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/mail-request-for-quotation/"

#create email template for quotation
axiosInstance
  .get("/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/mail-request-for-quotation/", {
    responseType: "blob",
  })
  .then((response) => {
    // take MailTo content from response data and put it in a fresh mail
    window.open(response.data);
  })

// Attach [...]_data_for_RFQ.zip to Mail, delete Warning, adjust message and send mail.

Get Asset (GET)

Fetch asset specified by part_id (url) and basename (body)

Form Data
ParameterDescriptionRequiredTypeValid Values
basenameasset file nametruestring1-255
Return Data
Fileresponse: myDrawing.pdf
Errors
PreconditionStatus codeError message
Part wit <part_id> exists in database404Object not found in database.
User is owner of part, or part is owned by user of the same organization.403Access forbidden.
Basename is valid422Invalid user input.
Usage
# GET "https://platform.3dspark.de/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/assets/"

#fetch Part visualization file
basename = "myDrawing.pdf"

axiosInstance
  .get("/api/v1/part/6ba40dc05533401caa9f47f014efd1f8/assets/", {
    responseType: "blob",
    params: {basename: basename},
  })
  .then((response) => {
    saveAs(response.data, basename);
  })

Upload Asset (POST)

Upload Asset to part if part_id is set or create new part.

Form Data
ParameterDescriptionRequiredTypeValid ValuesDefault
overwriteFlag if asset with the same name in part is to be overwrittenfalseboolTRUE, FALSE, “true”, “false” (all cases)FALSE
asset_typeAsset typetruestr“drawing”, “image”, “cad”, “offer”, “invoice”, “rfq”, “document”, “misc”
skip_drawing_analysisFlag whether the drawing analysis is to be skippedfalseboolTRUE, FALSE, “true”, “false” (all cases)FALSE
file Asset to be uploadedtruefilefilename size <= 225
Return Data
{
    "part_id": "bd288e8369c944e38ae22dbfe562ca3e",
    "task": "PartAssetApi",
    "message": "asset created",
    "name": "MyPart",
    "assets": {
        "fe7df47c31004429904c86d247650da8": {
            "basename": "MyDrawing.pdf",
            "asset_type": "drawing",
            "updated": "18.01.2023 14:00",
            "asset_stat": {
                "active": "pending",
                "choices": {
                    "upload": {
                        "name": "Upload",
                        "error": {
                            "message": null,
                            "error_raised": false,
                            "recommmended_user_action": null
                        },
                        "index": 0,
                        "finished": true,
                        "active_message": "Uploading CAD file",
                        "finished_message": "CAD file uploaded."
                    },
                    "image_analysis": {
                        "name": "Material Analysis",
                        "error": {
                            "message": null,
                            "error_raised": false,
                            "recommmended_user_action": null
                        },
                        "index": 1,
                        "finished": false,
                        "active_message": "Searching drawing for meta data",
                        "finished_message": "Drawing analysed."
                    }
                },
                "previous": "upload"
            },
            "analysis_results": {}
        },
        "cc836a9ac16a4d4abf14246d0f052345": {
            "basename": "314931ab3_drw.pdf",
            "asset_type": "drawing",
            "updated": "18.01.2023 13:57",
            "asset_stat": {
                "active": "pending",
                "choices": {
                    "upload": {
                        "name": "Upload",
                        "error": {
                            "message": null,
                            "error_raised": false,
                            "recommmended_user_action": null
                        },
                        "index": 0,
                        "finished": true,
                        "active_message": "Uploading CAD file",
                        "finished_message": "CAD file uploaded."
                    },
                    "image_analysis": {
                        "name": "Material Analysis",
                        "error": {
                            "message": null,
                            "error_raised": false,
                            "recommmended_user_action": null
                        },
                        "index": 1,
                        "finished": true,
                        "active_message": "Searching drawing for meta data",
                        "finished_message": "Drawing analysed."
                    }
                },
                "previous": "image_analysis"
            },
            "analysis_results": {
                "weight_deviated": false,
                "detected_dimension": null,
                "drawing_analysis": {
                    "drawing_analysis": {
                        "top_x_material_list": [
                            {
                                "mat_lvl_1": {
                                    "mat_id": "a8d07662d60a490195e03a8469f5266b",
                                    "mat_name": "31655.0"
                                },
                                "mat_lvl_2": {
                                    "mat_id": "4cf8e222b1264db1821b8d7a778420b7",
                                    "mat_name": "Aluminum Alloy"
                                },
                                "mat_lvl_3": {
                                    "mat_id": "e21a7371358d4c7c9aa9168ca9aa1d4e",
                                    "mat_name": "Light Metal"
                                },
                                "mat_lvl_4": {
                                    "mat_id": "287691973c9c42efaaab13fb8a64b283",
                                    "mat_name": "Metal"
                                },
                                "confidence": 0.19916228615356976,
                                "am_material": {
                                    "mat_id": "efc18e2bd38348b9bf0c779cd1f48e4d",
                                    "mat_name": "AlSi10Mg"
                                }
                            },
                            {
                                "mat_lvl_1": {
                                    "mat_id": "a8d07662d60a490195e03a8469f5266b",
                                    "mat_name": "31655.0"
                                },
                                "mat_lvl_2": {
                                    "mat_id": "4cf8e222b1264db1821b8d7a778420b7",
                                    "mat_name": "Aluminum Alloy"
                                },
                                "mat_lvl_3": {
                                    "mat_id": "e21a7371358d4c7c9aa9168ca9aa1d4e",
                                    "mat_name": "Light Metal"
                                },
                                "mat_lvl_4": {
                                    "mat_id": "287691973c9c42efaaab13fb8a64b283",
                                    "mat_name": "Metal"
                                },
                                "confidence": 0.20121889364401996,
                                "am_material": {
                                    "mat_id": "efc18e2bd38348b9bf0c779cd1f48e4d",
                                    "mat_name": "AlSi10Mg"
                                }
                            },
                            {
                                "mat_lvl_1": {
                                    "mat_id": "64f8f5a6866c49cea3e5bd48d6f15dec",
                                    "mat_name": "2011A"
                                },
                                "mat_lvl_2": {
                                    "mat_id": "4cf8e222b1264db1821b8d7a778420b7",
                                    "mat_name": "Aluminum Alloy"
                                },
                                "mat_lvl_3": {
                                    "mat_id": "e21a7371358d4c7c9aa9168ca9aa1d4e",
                                    "mat_name": "Light Metal"
                                },
                                "mat_lvl_4": {
                                    "mat_id": "287691973c9c42efaaab13fb8a64b283",
                                    "mat_name": "Metal"
                                },
                                "confidence": 0.1992250813629454,
                                "am_material": {
                                    "mat_id": "efc18e2bd38348b9bf0c779cd1f48e4d",
                                    "mat_name": "AlSi10Mg"
                                }
                            },
                            {
                                "mat_lvl_1": {
                                    "mat_id": "64f8f5a6866c49cea3e5bd48d6f15dec",
                                    "mat_name": "2011A"
                                },
                                "mat_lvl_2": {
                                    "mat_id": "4cf8e222b1264db1821b8d7a778420b7",
                                    "mat_name": "Aluminum Alloy"
                                },
                                "mat_lvl_3": {
                                    "mat_id": "e21a7371358d4c7c9aa9168ca9aa1d4e",
                                    "mat_name": "Light Metal"
                                },
                                "mat_lvl_4": {
                                    "mat_id": "287691973c9c42efaaab13fb8a64b283",
                                    "mat_name": "Metal"
                                },
                                "confidence": 0.2012314526858951,
                                "am_material": {
                                    "mat_id": "efc18e2bd38348b9bf0c779cd1f48e4d",
                                    "mat_name": "AlSi10Mg"
                                }
                            },
                            {
                                "mat_lvl_1": {
                                    "mat_id": "cd309ed7144a407fb376d8d0d67fd1cb",
                                    "mat_name": "3303"
                                },
                                "mat_lvl_2": {
                                    "mat_id": "4cf8e222b1264db1821b8d7a778420b7",
                                    "mat_name": "Aluminum Alloy"
                                },
                                "mat_lvl_3": {
                                    "mat_id": "e21a7371358d4c7c9aa9168ca9aa1d4e",
                                    "mat_name": "Light Metal"
                                },
                                "mat_lvl_4": {
                                    "mat_id": "287691973c9c42efaaab13fb8a64b283",
                                    "mat_name": "Metal"
                                },
                                "confidence": 0.19916228615356976,
                                "am_material": {
                                    "mat_id": "efc18e2bd38348b9bf0c779cd1f48e4d",
                                    "mat_name": "AlSi10Mg"
                                }
                            }
                        ],
                        "top_x_am_material_list": [
                            {
                                "mat_id": "efc18e2bd38348b9bf0c779cd1f48e4d",
                                "mat_name": "AlSi10Mg"
                            }
                        ]
                    }
                }
            }
        }
    }
}
Errors
PreconditionStatus codeError message
part_id is either empty or a valid uuid.422Invalid user input.
“overwrite” is empty or a valid bool.422Invalid user input.
User is owner of part, or user is manager and part is owned by user of the same organization.403Access forbidden.
File (asset) is passed in the body of the request.400No file given.
Usage
# POST "https://platform.3dspark.de/api/v1/part/0/assets/"

let formData = new FormData();
formData.append("file", file);
formData.append("asset_type", 'drawing');
formData.append("overwrite", "true"); // true: if there is a duplicate - overwrite the file

// make sure to have a valid url to post on
 (part_id = 0)

// upload any supported asset file
await this.axiosInstance
  .post(`/api/v1/part/0/assets/`, formData)
  .then((response) => {
    console.log(response.data)
  })

Delete Asset (Delete)

Delete asset from platform.

Form Data
ParameterDescriptionRequiredTypeValid Values
basenameasset file nametruestring1-255
Return Data
{
  ... see Upload Asset (POST),
  'message': 'Asset deleted.',
  ...
}
Errors
PreconditionStatus codeError message
Part with <part_id> exists in database404Object not found in database.
User is owner of part, or user is manager and part is owned by user of the same organization.403Access forbidden.
Asset with basename can be found in part.404Object not found in storage.
Usage
# DELETE "https://platform.3dspark.de/api/v1/part/bd288e8369c944e38ae22dbfe562ca3e/assets/"

let formData = new FormData();
formData.append("basename", "MyDrawing.pdf");

// upload any supported asset file
await this.axiosInstance
  .post(`/api/v1/part/bd288e8369c944e38ae22dbfe562ca3e/assets/`, formData)
  .then((response) => {
    console.log(response.data)
  })