The PrintWatch API follows the REST specification. Our API accepts encoded requests and returns JSON responses that use the standard HTTP response codes in addition to custom code that are tabulated in section 2.0 below. The repository containing the client code for PrintWatch can be found in the PrintWatch repository
Check out the developer quickstart guide.
The term Inference indicates that the user will be making API requests for the detection model to be applied to their image. In order to do this, follow steps 1.1 – 1.3 below.
The PrintWatch API uses API keys to authenticate requests. You can manage your API keys from the confirmation email sent to your email after checkout.
Your API key will allow you to make simultaneous inference requests on the specified amount of devices for your plan. Multi-device plans use the same API key and limit you to the amount of devices allowed by your plan. See pricing.
Your API access keys should not be shared or distributed to anyone outside of your organization since they grant access to your PrintWatch resources. Do not share your API keys on debugging forums such as GitHub or Discord.
An example for an authenticated inference request is shown below:
A successful response for the above request will be in the form of:
The statusCode 200 indicates that the request worked as expected with no issues. The defect_detected property is a boolean value indicating the model’s detection of any defect in the image provided at the given confidence threshold. In the above example the model indicates that it has detected a defect with the True response for the defect_detected property.
2.0 HTTP Codes
In addition to using the standard HTTP codes, PrintWatch deploys custom response codes for special events, tabulated below:
|210||Issue with Image data||The Image data included in the inference request is not in the correct format.|
|211||Bad inference request||There was an issue with the inference request or a post-processing algorithm. Use standard input parameters for the API request. If this issue persists, contact support.|
|212||Settings check failed||Either the API key is not valid, the printer is in use already, or you are making calls too frequently.|
|213||Print time too soon||Inferencing begins after 5 minutes into the print jobs. Wait until the print job is 5 minutes or more into the print.|
|214||New user added||This is your first API request with a new API key or printer. Try the inference request again and the response code will be 200.|
|215||Issue with payload data||The payload does not contain the required information. Try setting the confidence and email settings.|
|216||No inference criteria met||User does not have a valid API key or meet any of the criteria for inference.|
|217||Invalid API key||User does not have a valid API key|
|218||Unavailable print time||The print time has not been initialized by OctoPrint yet.|