Update maintenance record
Partially update a maintenance record by ID: change only the fields you send, such as status, cost, vendor or reminders, with If-Match concurrency.
curl --request PATCH \
--url https://integrations.alvys.com/api/p/v{version}/maintenance/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json-patch+json' \
--header 'If-Match: <if-match>' \
--data '
{
"Category": {
"Id": "<string>",
"Name": "<string>"
},
"Status": "<string>",
"Date": "2023-11-07T05:31:56Z",
"Description": "<string>",
"Comments": "<string>",
"Amount": 123,
"PO": "<string>",
"Reference": "<string>",
"RepairShop": {
"Id": "<string>",
"Name": "<string>"
},
"Vendor": {
"Id": "<string>",
"Name": "<string>"
},
"OdometerReading": 123,
"WorkPerformed": "<string>",
"Reminders": [
{
"DueDate": "2023-11-07T05:31:56Z"
}
]
}
'const options = {
method: 'PATCH',
headers: {
'If-Match': '<if-match>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json-patch+json'
},
body: JSON.stringify({
Category: {Id: '<string>', Name: '<string>'},
Status: '<string>',
Date: '2023-11-07T05:31:56Z',
Description: '<string>',
Comments: '<string>',
Amount: 123,
PO: '<string>',
Reference: '<string>',
RepairShop: {Id: '<string>', Name: '<string>'},
Vendor: {Id: '<string>', Name: '<string>'},
OdometerReading: 123,
WorkPerformed: '<string>',
Reminders: [{DueDate: '2023-11-07T05:31:56Z'}]
})
};
fetch('https://integrations.alvys.com/api/p/v{version}/maintenance/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://integrations.alvys.com/api/p/v{version}/maintenance/{id}"
payload = {
"Category": {
"Id": "<string>",
"Name": "<string>"
},
"Status": "<string>",
"Date": "2023-11-07T05:31:56Z",
"Description": "<string>",
"Comments": "<string>",
"Amount": 123,
"PO": "<string>",
"Reference": "<string>",
"RepairShop": {
"Id": "<string>",
"Name": "<string>"
},
"Vendor": {
"Id": "<string>",
"Name": "<string>"
},
"OdometerReading": 123,
"WorkPerformed": "<string>",
"Reminders": [{ "DueDate": "2023-11-07T05:31:56Z" }]
}
headers = {
"If-Match": "<if-match>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json-patch+json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://integrations.alvys.com/api/p/v{version}/maintenance/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'Category' => [
'Id' => '<string>',
'Name' => '<string>'
],
'Status' => '<string>',
'Date' => '2023-11-07T05:31:56Z',
'Description' => '<string>',
'Comments' => '<string>',
'Amount' => 123,
'PO' => '<string>',
'Reference' => '<string>',
'RepairShop' => [
'Id' => '<string>',
'Name' => '<string>'
],
'Vendor' => [
'Id' => '<string>',
'Name' => '<string>'
],
'OdometerReading' => 123,
'WorkPerformed' => '<string>',
'Reminders' => [
[
'DueDate' => '2023-11-07T05:31:56Z'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json-patch+json",
"If-Match: <if-match>"
],
]);
$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://integrations.alvys.com/api/p/v{version}/maintenance/{id}"
payload := strings.NewReader("{\n \"Category\": {\n \"Id\": \"<string>\",\n \"Name\": \"<string>\"\n },\n \"Status\": \"<string>\",\n \"Date\": \"2023-11-07T05:31:56Z\",\n \"Description\": \"<string>\",\n \"Comments\": \"<string>\",\n \"Amount\": 123,\n \"PO\": \"<string>\",\n \"Reference\": \"<string>\",\n \"RepairShop\": {\n \"Id\": \"<string>\",\n \"Name\": \"<string>\"\n },\n \"Vendor\": {\n \"Id\": \"<string>\",\n \"Name\": \"<string>\"\n },\n \"OdometerReading\": 123,\n \"WorkPerformed\": \"<string>\",\n \"Reminders\": [\n {\n \"DueDate\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("If-Match", "<if-match>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json-patch+json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://integrations.alvys.com/api/p/v{version}/maintenance/{id}")
.header("If-Match", "<if-match>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json-patch+json")
.body("{\n \"Category\": {\n \"Id\": \"<string>\",\n \"Name\": \"<string>\"\n },\n \"Status\": \"<string>\",\n \"Date\": \"2023-11-07T05:31:56Z\",\n \"Description\": \"<string>\",\n \"Comments\": \"<string>\",\n \"Amount\": 123,\n \"PO\": \"<string>\",\n \"Reference\": \"<string>\",\n \"RepairShop\": {\n \"Id\": \"<string>\",\n \"Name\": \"<string>\"\n },\n \"Vendor\": {\n \"Id\": \"<string>\",\n \"Name\": \"<string>\"\n },\n \"OdometerReading\": 123,\n \"WorkPerformed\": \"<string>\",\n \"Reminders\": [\n {\n \"DueDate\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}")
.asString();{
"Id": "<string>",
"RelatedAsset": {
"AssetId": "<string>",
"AssetType": "<string>",
"AssetNumber": "<string>"
},
"Category": {
"Id": "<string>",
"Name": "<string>"
},
"Amount": {
"Amount": 123,
"Currency": 123
},
"CreatedAt": "2023-11-07T05:31:56Z",
"CreatedBy": "<string>",
"Status": "<string>",
"OdometerReading": 123,
"IsDeducted": true,
"PO": "<string>",
"Reference": "<string>",
"Description": "<string>",
"Comments": "<string>",
"RepairShop": {
"Id": "<string>",
"Name": "<string>"
},
"Reminders": [
{
"id": "<string>",
"DueDate": "2023-11-07T05:31:56Z"
}
],
"ModifiedAt": "2023-11-07T05:31:56Z",
"ModifiedBy": "<string>",
"RecordNumber": "<string>",
"Date": "2023-11-07T05:31:56Z",
"WorkPerformed": "<string>",
"Vendor": {
"Id": "<string>",
"Name": "<string>"
},
"ExternalId": "<string>"
}{
"Errors": {},
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}maintenance:update scope. See Authentication.If-Match is required
This endpoint uses optimistic concurrency. Send the record’s currentETag in the If-Match header. The ETag response header of Get maintenance record, of Create maintenance record, and of every successful update carries it.
- If you omit
If-Match, the request is rejected with428 Precondition Required. - If the record changed after you read it, the request is rejected with
412 Precondition Failed. Get the record again and retry with the newETag.
Clearing values
- Free-text fields (
Description,Comments,PO,Reference,WorkPerformed): send an empty string. - RepairShop and Vendor: send an empty object,
{}. - Category cannot be cleared. Sending an empty object is rejected with
400 Bad Request. - Reminders are replaced as a whole list: send the full list you want to keep, or
[]to remove all of them.
[], it clears the record’s reminders. Leave Reminders out of the body when you do not mean to change them.Category, RepairShop and Vendor are resolved by Name, as in Create maintenance record.
The asset cannot be changed
A maintenance record stays on the truck or trailer it was created for. The body has noAsset field. To move work to another asset, create a new record against it.
Records linked to a driver deduction
WhenIsDeducted is true, the record is linked to a driver settlement deduction made in Alvys. Category, Description, Amount and Date cannot be changed through this endpoint, because the change would replace that deduction and change the driver’s pay. A request that sends any of them is rejected with 422 Unprocessable Entity and the problem type https://api.alvys.com/errors/UnprocessableEntity/MaintenanceDeductionLocked. You can still change the other fields, or edit the record in Alvys.
A body with nothing to change
A body with no fields,{}, changes nothing. The request still needs a current If-Match, and it returns 200 OK with the record and its unchanged ETag.
Request parameters
The following parameters are required in the URL path:| Parameter | Type | Required | Description |
|---|---|---|---|
| version | String | Yes | The version of the API. |
| id | String | Yes | The unique identifier of the maintenance record. |
| Header | Required | Description |
|---|---|---|
| If-Match | Yes | The current ETag of the maintenance record. |
Request body
All fields are optional. Limits and allowed values are the same as in Create maintenance record.| Field | Type | Description |
|---|---|---|
| Category | Object | The kind of work, with Name and an optional Id. Cannot be cleared. |
| Status | String | One of Urgent, Open, Closed (case-insensitive). |
| Date | String (Date-Time) | When the work was done or is scheduled. |
| Description | String | A short summary of the work. Up to 500 characters. |
| Comments | String | Free-form notes. Up to 2,000 characters. |
| Amount | Number | The total cost in USD. Cannot be negative. |
| PO | String | The purchase order number. Up to 100 characters. |
| Reference | String | Your reference number. Up to 100 characters. |
| RepairShop | Object | Where the work is done, with Name and an optional Id. Send {} to clear it. |
| Vendor | Object | Who bills for the work, with Name and an optional Id. Send {} to clear it. |
| OdometerReading | Number | The odometer of the asset at the time of service, in miles. Cannot be negative. |
| WorkPerformed | String | A longer description of the work done. Up to 2,000 characters. |
| Reminders | Array | Replaces the whole reminder list. Up to 25, each with a DueDate. Send [] to remove all reminders. |
ExternalId cannot be changed.
Example cURL request
curl --location --request PATCH 'https://integrations.alvys.com/api/p/v1/maintenance/4b0e6a52-0000-0000-0000-000000000417' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--header 'If-Match: "00000000-0000-0000-0000-000000000001"' \
--data-raw '{
"Status": "Closed",
"Amount": 468.10,
"Comments": "Final invoice received"
}'
YOUR_ACCESS_TOKEN with your actual Bearer token and the If-Match value with the record’s current ETag.
Response fields
A successful request returns200 OK with the updated record, in the same shape as Create maintenance record. The new ETag is in the ETag response header.
Status codes
| Status | Meaning |
|---|---|
| 200 | The record was updated, or the body had nothing to change. |
| 400 | The request body failed validation. The response lists the invalid fields. |
| 401 | The request was not authenticated. |
| 403 | The caller lacks the maintenance:update scope. |
| 404 | No maintenance record with this id exists, it was deleted, or its asset is outside the subsidiaries your credential can access. |
| 409 | The update clashed with another change saved at the same moment. Get the record again and retry. |
| 412 | The If-Match value did not match the current record. Get the record again and retry. |
| 422 | The record is linked to a driver deduction and the body changes Category, Description, Amount or Date (MaintenanceDeductionLocked). |
| 428 | The If-Match header is missing. |
| 429 | The rate limit was exceeded. |
Rate limits
All endpoints are subject to rate limits to protect the API from traffic spikes. For detailed information on rate limits, please refer to the Rate Limits section. This page is interactive, allowing you to try a request by specifying the API version and the maintenance record id in the URL path. As you fill out the parameters, the cURL command on the right side of the page will be automatically updated.Authorizations
OAuth 2.0 client-credentials access token. Obtain one from https://auth.alvys.com/oauth/token (grant_type=client_credentials, audience=https://api.alvys.com/public/), then paste it here. The playground sends it as Authorization: Bearer <token>.
Headers
Body
Replaces the whole reminder list when supplied. Omit the property to leave the stored reminders unchanged; send [] to remove them all. Note the consequence: a client that serializes an unset collection as [] will clear this record's reminders, so omit the property rather than sending an empty array. Same rule as Email and Phone on the customer write surface.
Show child attributes
Show child attributes
Response
OK
Per-tenant sequence number, server-assigned and not writable. Unique within your tenant, so it is safe to reconcile against: a simultaneous create cannot take the same number. NOT guaranteed gapless or strictly increasing - a losing race burns a number and a deleted record leaves its number behind, so treat it as an identifier, not a count.
curl --request PATCH \
--url https://integrations.alvys.com/api/p/v{version}/maintenance/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json-patch+json' \
--header 'If-Match: <if-match>' \
--data '
{
"Category": {
"Id": "<string>",
"Name": "<string>"
},
"Status": "<string>",
"Date": "2023-11-07T05:31:56Z",
"Description": "<string>",
"Comments": "<string>",
"Amount": 123,
"PO": "<string>",
"Reference": "<string>",
"RepairShop": {
"Id": "<string>",
"Name": "<string>"
},
"Vendor": {
"Id": "<string>",
"Name": "<string>"
},
"OdometerReading": 123,
"WorkPerformed": "<string>",
"Reminders": [
{
"DueDate": "2023-11-07T05:31:56Z"
}
]
}
'const options = {
method: 'PATCH',
headers: {
'If-Match': '<if-match>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json-patch+json'
},
body: JSON.stringify({
Category: {Id: '<string>', Name: '<string>'},
Status: '<string>',
Date: '2023-11-07T05:31:56Z',
Description: '<string>',
Comments: '<string>',
Amount: 123,
PO: '<string>',
Reference: '<string>',
RepairShop: {Id: '<string>', Name: '<string>'},
Vendor: {Id: '<string>', Name: '<string>'},
OdometerReading: 123,
WorkPerformed: '<string>',
Reminders: [{DueDate: '2023-11-07T05:31:56Z'}]
})
};
fetch('https://integrations.alvys.com/api/p/v{version}/maintenance/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://integrations.alvys.com/api/p/v{version}/maintenance/{id}"
payload = {
"Category": {
"Id": "<string>",
"Name": "<string>"
},
"Status": "<string>",
"Date": "2023-11-07T05:31:56Z",
"Description": "<string>",
"Comments": "<string>",
"Amount": 123,
"PO": "<string>",
"Reference": "<string>",
"RepairShop": {
"Id": "<string>",
"Name": "<string>"
},
"Vendor": {
"Id": "<string>",
"Name": "<string>"
},
"OdometerReading": 123,
"WorkPerformed": "<string>",
"Reminders": [{ "DueDate": "2023-11-07T05:31:56Z" }]
}
headers = {
"If-Match": "<if-match>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json-patch+json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://integrations.alvys.com/api/p/v{version}/maintenance/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'Category' => [
'Id' => '<string>',
'Name' => '<string>'
],
'Status' => '<string>',
'Date' => '2023-11-07T05:31:56Z',
'Description' => '<string>',
'Comments' => '<string>',
'Amount' => 123,
'PO' => '<string>',
'Reference' => '<string>',
'RepairShop' => [
'Id' => '<string>',
'Name' => '<string>'
],
'Vendor' => [
'Id' => '<string>',
'Name' => '<string>'
],
'OdometerReading' => 123,
'WorkPerformed' => '<string>',
'Reminders' => [
[
'DueDate' => '2023-11-07T05:31:56Z'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json-patch+json",
"If-Match: <if-match>"
],
]);
$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://integrations.alvys.com/api/p/v{version}/maintenance/{id}"
payload := strings.NewReader("{\n \"Category\": {\n \"Id\": \"<string>\",\n \"Name\": \"<string>\"\n },\n \"Status\": \"<string>\",\n \"Date\": \"2023-11-07T05:31:56Z\",\n \"Description\": \"<string>\",\n \"Comments\": \"<string>\",\n \"Amount\": 123,\n \"PO\": \"<string>\",\n \"Reference\": \"<string>\",\n \"RepairShop\": {\n \"Id\": \"<string>\",\n \"Name\": \"<string>\"\n },\n \"Vendor\": {\n \"Id\": \"<string>\",\n \"Name\": \"<string>\"\n },\n \"OdometerReading\": 123,\n \"WorkPerformed\": \"<string>\",\n \"Reminders\": [\n {\n \"DueDate\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("If-Match", "<if-match>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json-patch+json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://integrations.alvys.com/api/p/v{version}/maintenance/{id}")
.header("If-Match", "<if-match>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json-patch+json")
.body("{\n \"Category\": {\n \"Id\": \"<string>\",\n \"Name\": \"<string>\"\n },\n \"Status\": \"<string>\",\n \"Date\": \"2023-11-07T05:31:56Z\",\n \"Description\": \"<string>\",\n \"Comments\": \"<string>\",\n \"Amount\": 123,\n \"PO\": \"<string>\",\n \"Reference\": \"<string>\",\n \"RepairShop\": {\n \"Id\": \"<string>\",\n \"Name\": \"<string>\"\n },\n \"Vendor\": {\n \"Id\": \"<string>\",\n \"Name\": \"<string>\"\n },\n \"OdometerReading\": 123,\n \"WorkPerformed\": \"<string>\",\n \"Reminders\": [\n {\n \"DueDate\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}")
.asString();{
"Id": "<string>",
"RelatedAsset": {
"AssetId": "<string>",
"AssetType": "<string>",
"AssetNumber": "<string>"
},
"Category": {
"Id": "<string>",
"Name": "<string>"
},
"Amount": {
"Amount": 123,
"Currency": 123
},
"CreatedAt": "2023-11-07T05:31:56Z",
"CreatedBy": "<string>",
"Status": "<string>",
"OdometerReading": 123,
"IsDeducted": true,
"PO": "<string>",
"Reference": "<string>",
"Description": "<string>",
"Comments": "<string>",
"RepairShop": {
"Id": "<string>",
"Name": "<string>"
},
"Reminders": [
{
"id": "<string>",
"DueDate": "2023-11-07T05:31:56Z"
}
],
"ModifiedAt": "2023-11-07T05:31:56Z",
"ModifiedBy": "<string>",
"RecordNumber": "<string>",
"Date": "2023-11-07T05:31:56Z",
"WorkPerformed": "<string>",
"Vendor": {
"Id": "<string>",
"Name": "<string>"
},
"ExternalId": "<string>"
}{
"Errors": {},
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}