Skip to main content
The ITSM-NG REST API supports updating existing items using PUT or PATCH methods. Both methods function identically and can update single or multiple items.

Update Item(s)

Update one or more existing items in ITSM-NG.

Endpoint

PUT /apirest.php/:itemtype/:id
or
PATCH /apirest.php/:itemtype/:id

HTTP Methods

Both PUT and PATCH are supported and behave identically for updates.

Headers

Session-Token
string
required
Session token obtained from initSession
App-Token
string
Optional authorization string from API configuration
Content-Type
string
required
Must be application/json

URL Parameters

id
integer
The unique identifier of the item to update. Optional if provided in the request body.

Request Body

input
object | array
required
For single item: an object with fields to updateFor multiple items: an array of objects, each containing an id field and the fields to update

Response

id
boolean
true if update succeeded, false if failed
message
string
Status message or error description
Returns an array of objects with update status for each item.

Response Codes

  • 200 OK - Item(s) updated successfully
  • 207 Multi-Status - Bulk operation with some failures
  • 400 Bad Request - Invalid input parameters
  • 401 Unauthorized - Invalid or missing session token
  • 404 Not Found - Item not found

Update Single Item (URL ID)

Update a single item by specifying the ID in the URL.

Example Request

curl -X PUT \
-H 'Content-Type: application/json' \
-H "Session-Token: 83af7e620c83a50a18d3eac2f6ed05a3ca0bea62" \
-H "App-Token: f7g3csp8mgatg5ebc5elnazakw20i9fyev1qopya7" \
-d '{"input": {"otherserial": "xcvbn"}}' \
'http://path/to/glpi/apirest.php/Computer/10'

Example Response

[
  {
    "10": true,
    "message": ""
  }
]

Update Single Item (Body ID)

Update a single item by specifying the ID in the request body.

Example Request

curl -X PUT \
-H 'Content-Type: application/json' \
-H "Session-Token: 83af7e620c83a50a18d3eac2f6ed05a3ca0bea62" \
-H "App-Token: f7g3csp8mgatg5ebc5elnazakw20i9fyev1qopya7" \
-d '{"input": {"id": 11, "otherserial": "abcde"}}' \
'http://path/to/glpi/apirest.php/Computer/'

Example Response

[
  {
    "11": true,
    "message": ""
  }
]
You can omit the ID from the URL and provide it in the input object instead. This is useful when updating multiple items or when building generic update functions.

Update Multiple Items (Bulk)

Update multiple items in a single request.

Example Request

curl -X PUT \
-H 'Content-Type: application/json' \
-H "Session-Token: 83af7e620c83a50a18d3eac2f6ed05a3ca0bea62" \
-H "App-Token: f7g3csp8mgatg5ebc5elnazakw20i9fyev1qopya7" \
-d '{"input": [
  {"id": 16, "otherserial": "abcde"},
  {"id": 17, "otherserial": "fghij"}
]}' \
'http://path/to/glpi/apirest.php/Computer/'

Example Response

[
  {
    "16": true,
    "message": ""
  },
  {
    "17": false,
    "message": "Item not found"
  }
]
Each object in the input array must include an id field to identify which item to update. Items without an id will fail.

Using PATCH Method

The PATCH method works identically to PUT.

Example Request

curl -X PATCH \
-H 'Content-Type: application/json' \
-H "Session-Token: 83af7e620c83a50a18d3eac2f6ed05a3ca0bea62" \
-H "App-Token: f7g3csp8mgatg5ebc5elnazakw20i9fyev1qopya7" \
-d '{"input": {"id": 10, "comment": "Updated comment"}}' \
'http://path/to/glpi/apirest.php/Computer/'

Example Response

[
  {
    "10": true,
    "message": ""
  }
]

Special Use Cases

Lost Password Request

Request a password reset for a user account.

Endpoint

PUT /apirest.php/lostPassword/

Requirements

  • GLPI must have notifications enabled
  • The email address must belong to an existing user

Request Body

email
string
required
Email address of the user requesting password reset

Example Request

curl -X PUT \
-H 'Content-Type: application/json' \
-d '{"email": "user@domain.com"}' \
'http://path/to/glpi/apirest.php/lostPassword'

Example Response

200 OK

Password Reset

Complete the password reset process using a reset token.

Endpoint

PUT /apirest.php/lostPassword/

Request Body

email
string
required
Email address of the user
password_forget_token
string
required
Reset token received via email
password
string
required
The new password

Example Request

curl -X PUT \
-H 'Content-Type: application/json' \
-d '{
  "email": "user@domain.com",
  "password_forget_token": "b0a4cfe81448299ebed57442f4f21929c80ebee5",
  "password": "NewPassword"
}' \
'http://path/to/glpi/apirest.php/lostPassword'

Example Response

200 OK

Common Update Fields

Standard Fields

name
string
Update the item name
comment
string
Update comments or description
entities_id
integer
Move item to different entity
is_deleted
boolean
Soft delete/restore the item (use DELETE endpoint for actual deletion)

Asset Fields

serial
string
Update serial number
otherserial
string
Update inventory number
contact
string
Update contact person
locations_id
integer
Update location
states_id
integer
Update state (e.g., move to Production)
users_id_tech
integer
Update technical manager

ITIL Fields

content
string
Update ticket/problem/change content
status
integer
Update status (e.g., close ticket)
priority
integer
Update priority level (1-5)
urgency
integer
Update urgency level (1-5)
impact
integer
Update impact level (1-5)

Partial vs. Full Updates

The API supports partial updates - you only need to include fields you want to change.

Partial Update Example

Update only the serial number:
{
  "input": {
    "id": 10,
    "serial": "NEW-SERIAL-123"
  }
}
All other fields remain unchanged.

Full Update Example

Update multiple fields:
{
  "input": {
    "id": 10,
    "serial": "NEW-SERIAL-123",
    "otherserial": "INV-456",
    "locations_id": 5,
    "states_id": 1,
    "comment": "Updated via API"
  }
}

Error Handling

Common Errors

ERROR_GLPI_UPDATE
error
Unable to update the item. Check GLPI logs for details.
ERROR_GLPI_PARTIAL_UPDATE
error
Some items in bulk operation failed. Check the response array for individual results.
ERROR_ITEM_NOT_FOUND
error
The specified item ID does not exist.
ERROR_RIGHT_MISSING
error
User lacks permission to update items of this type.

Validation Errors

Updates may fail due to:
  • Invalid foreign keys: Referenced IDs must exist
  • Business rules: Some fields have constraints (e.g., can’t reopen closed tickets)
  • Locked items: Items locked by another process
  • Permission issues: User profile must have update rights

Best Practices

ID Precedence: When both URL ID and body ID are provided, the URL ID takes precedence. For consistency, choose one approach.
Bulk Updates: Use bulk updates instead of individual requests when updating multiple items to reduce API calls.
Optimistic Locking: Consider implementing optimistic locking by checking date_mod before updates to prevent overwriting concurrent changes.
Session Write Mode: Update operations require write access to the session. The API automatically enables write mode for PUT/PATCH operations.
Audit Trail: All updates are logged in GLPI’s history unless you explicitly disable it with the history parameter.
Field Omission: Fields not included in the input object are not modified. There’s no need to send the complete object.

Build docs developers (and LLMs) love