curl --request POST \
--url https://api.ionworks.com/cyclers/{cycler_id}/service_events/complete \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://api.ionworks.com/cyclers/{cycler_id}/service_events/complete"
payload = {}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://api.ionworks.com/cyclers/{cycler_id}/service_events/complete', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ionworks.com/cyclers/{cycler_id}/service_events/complete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ionworks.com/cyclers/{cycler_id}/service_events/complete"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ionworks.com/cyclers/{cycler_id}/service_events/complete")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ionworks.com/cyclers/{cycler_id}/service_events/complete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"organization_id": "<string>",
"project_id": "<string>",
"cycler_id": "<string>",
"event_type": "calibration",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"scheduled_for": "2023-11-07T05:31:56Z",
"scheduled_until": "2023-11-07T05:31:56Z",
"performed_at": "2023-11-07T05:31:56Z",
"notes": "<string>",
"created_by": "<string>",
"performed_by": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Record a cycler's open service as done
Record service as done on a cycler.
Two paths behind one endpoint, chosen by whether the cycler is currently out of service:
- Open event (it was taken out first): that event is completed and every channel incident pointing at it is closed in one write, so the cycler cannot end up half returned to service.
- No open event: the common case of “I calibrated this, log it”. A
single already-completed event is recorded from the request’s
event_type. Nothing was taken out, so nothing needs returning, and no one has to open an event purely so it can be closed.
Either way a calibration advances last_calibrated_at — the only
supported way that field moves — and optionally updates
calibration_interval_days.
Addressed by cycler rather than by event id because a cycler has at most one open event: the caller already knows which cycler it serviced, and looking up the event id first would be a round-trip that proves nothing.
curl --request POST \
--url https://api.ionworks.com/cyclers/{cycler_id}/service_events/complete \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://api.ionworks.com/cyclers/{cycler_id}/service_events/complete"
payload = {}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://api.ionworks.com/cyclers/{cycler_id}/service_events/complete', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ionworks.com/cyclers/{cycler_id}/service_events/complete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ionworks.com/cyclers/{cycler_id}/service_events/complete"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ionworks.com/cyclers/{cycler_id}/service_events/complete")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ionworks.com/cyclers/{cycler_id}/service_events/complete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"organization_id": "<string>",
"project_id": "<string>",
"cycler_id": "<string>",
"event_type": "calibration",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"scheduled_for": "2023-11-07T05:31:56Z",
"scheduled_until": "2023-11-07T05:31:56Z",
"performed_at": "2023-11-07T05:31:56Z",
"notes": "<string>",
"created_by": "<string>",
"performed_by": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Body
The body is of type Raw Data · object.
Response
Successful Response
One instrument-level service on a cycler.
A service event is the thing a channel incident belongs to when the whole
cycler is down. Calibration is performed on the instrument, so a
40-channel cycler going in for its annual calibration is one event, not 40
unrelated outages that happen to share a category. Channel incidents opened
for the event carry its id in service_event_id, which is what lets one
action close them together.
At most one event per cycler may be open (performed_at null) — a unique
partial index enforces it, so "the current service" is a single unambiguous
row and the open-event write path is safe to retry.
Was this page helpful?