Chapter 4. Using the API
4-1. API code
If you open the dataset and select the “API” tab, API sample code and API key information are displayed.
By executing the API with your PC or PLC, in accordance with the sample code, you can send image data and receive inspection results.
If the size of the image to be sent is larger than 800 pixels, resize to 800 pixels.
4-2. Checking information on API details
If you select the “API” tab on the side menu, you can check the API usage situation for each dataset.
Detailed information for each dataset can be checked with the respective “Detail” buttons.
[Explanation of table]
|Name of the dataset
|AI model Name
|Name of AI model for the dataset
|AI model ID
|ID of AI model for the dataset
|User who created the dataset
|API availability status for the dataset
Available: API can be used
Note available: API cannot be used
Restricted: API cannot be used (temporarily suspended)
|Free API available
|Remaining number of free API calls for this dataset
|Email address to receive alerts
|Email address for receiving alerts on the dataset
|Additional Email address to receive alerts
|Additional email address for receiving alerts on the dataset
|Send an alert at the number 1
|Number of API uses for sending the first alert for the dataset
|Send an alert at the number 2
|Number of API uses for sending the second alert for the dataset
|Maximum number of APIs per month
|Maximum number of API uses per month for the dataset
|Send a test alert mail
|Send test alert for the dataset
Note 1) An API report can be displayed or saved for the current or previous year. If you will need data from two years or more earlier, save the data by downloading to your local disk.
4-3. How to set API use limit and alerts
To monitor and limit greater than expected use, the fee-based plan is provided with an API use limit and alerts. Set these as necessary.
Select the “API” tab on the side menu, and select “Detail” for the dataset for which you want to set the API use limit or alerts.
The maximum number of API uses per month can be set with “Maximum number of APIs per month”.
When the maximum number of API uses is attained, “Status” changes to “Restricted”, and the API can no longer be used. To resume use, increase the value of “Maximum number of APIs per month”, press the gear icon for “API Call Status” on the dataset detail screen, and reset to “Available”.
Using “Send an alert at the number” you can set up to a maximum of two API use counts for sending alerts.
4-4. API response
When a request is sent to the API for the image you want to inspect, the following values are returned in the JSON format.
|API request ID
|Time image sent to API was inspected
|Maximum anomaly score of image sent to API
|Judgment results for image sent to API based on main threshold
|Judgment results for image sent to API based on sub threshold
|Name of image file sent to API
|Inspection results for image sent to API
Normal: Judged to be normal
Anomaly: Judged to be anomalous
Not-clear: Judged to require reinspection
When an API request succeeds, the status code 200 is returned. If the API is not available or the API request fails, a value other than 200 is returned as the status code.