Error Response Format
All API errors return a JSON array with two elements:Example Error Response
HTTP Status Codes
The API uses standard HTTP status codes:| Code | Status | Meaning |
|---|---|---|
| 200 | OK | Request succeeded |
| 201 | Created | Resource created successfully |
| 204 | No Content | Request succeeded with no response body |
| 206 | Partial Content | Partial data returned (pagination) |
| 207 | Multi-Status | Batch operation with mixed results |
| 400 | Bad Request | Invalid request parameters |
| 401 | Unauthorized | Authentication failed |
| 403 | Forbidden | Insufficient permissions |
| 404 | Not Found | Resource not found |
| 405 | Method Not Allowed | HTTP method not supported |
| 500 | Internal Server Error | Server error occurred |
Authentication Errors
ERROR_LOGIN_PARAMETERS_MISSING
HTTP Code: 400 Bad Request Description: Missing required login parameters Cause: Neither username/password nor user_token was provided to initSession Solution:ERROR_LOGIN_WITH_CREDENTIALS_DISABLED
HTTP Code: 400 Bad Request Description: Login with username/password is disabled in configuration Cause: ITSM-NG is configured to only allow user_token authentication Solution: Use user_token instead of credentials:ERROR_GLPI_LOGIN_USER_TOKEN
HTTP Code: 401 Unauthorized Description: The provided user_token is invalid Cause: User token doesn’t exist or has been regenerated Solution:- Log into ITSM-NG web interface
- Go to My Settings > Remote access key
- Copy the current token or generate a new one
- Update your API client with the correct token
ERROR_GLPI_LOGIN
HTTP Code: 401 Unauthorized Description: Login failed - generic authentication error Possible Causes:- Invalid username or password
- Account is disabled
- Account is locked
- LDAP authentication issues
- Verify credentials are correct
- Check user account status in ITSM-NG
- Review ITSM-NG logs in
files/_logs/ - Check authentication method configuration
ERROR_SESSION_TOKEN_MISSING
HTTP Code: 400 Bad Request Description: Session token is missing or empty Cause: Request requires authentication but no Session-Token header was provided Solution: Include Session-Token in all requests after initSession:ERROR_SESSION_TOKEN_INVALID
HTTP Code: 401 Unauthorized Description: Session token is invalid or expired Possible Causes:- Session was terminated
- Token is malformed
- Session expired
- Using token from different session
Authorization Errors
ERROR_APP_TOKEN_PARAMETERS_MISSING
HTTP Code: 400 Bad Request Description: App-Token is required but not provided Cause: API client configuration requires App-Token Solution: Include App-Token header:ERROR_WRONG_APP_TOKEN_PARAMETER
HTTP Code: 400 Bad Request Description: App-Token doesn’t match configuration Cause: Provided App-Token doesn’t exist in ITSM-NG Solution:- Navigate to Setup > General > API in ITSM-NG
- Check API client configuration
- Copy the correct App-Token
- Update your API client
ERROR_NOT_ALLOWED_IP
HTTP Code: 400 Bad Request (returned as false) Description: Client IP address is not authorized Cause: Your IP is not in the allowed range for any active API client Solution:- Check your current IP address
- In ITSM-NG, go to Setup > General > API
- Add your IP to an API client’s allowed range:
- IPv4: Configure start and end range
- IPv6: Add specific address
- Ensure API client is active
ERROR_RIGHT_MISSING
HTTP Code: 403 Forbidden Description: User doesn’t have permission for this action Cause: Current user’s profile lacks required rights Solution:- Check user profile permissions in ITSM-NG
- Grant necessary rights (READ, CREATE, UPDATE, DELETE, PURGE)
- Or switch to a profile with appropriate permissions:
Resource Errors
ERROR_ITEM_NOT_FOUND
HTTP Code: 404 Not Found Description: Requested item doesn’t exist Cause:- Item ID doesn’t exist
- Item was deleted
- User doesn’t have access to the entity
- Verify the item ID
- Check if item exists in the database
- Ensure active entity includes the item’s entity
- Try searching instead of direct access:
ERROR_RESOURCE_NOT_FOUND_NOR_COMMONDBTM
HTTP Code: 400 Bad Request Description: Requested itemtype is not valid Cause:- Itemtype doesn’t exist
- Itemtype is not a valid GLPI class
- Typo in itemtype name
- Check itemtype spelling (case-sensitive)
- Ensure itemtype inherits from CommonDBTM
- Valid examples:
Computer,Ticket,User,Monitor
ERROR_RESOURCE_MISSING
HTTP Code: 400 Bad Request Description: No resource specified in request Cause: Empty or missing endpoint path Solution: Specify a valid endpoint:ERROR_METHOD_NOT_ALLOWED
HTTP Code: 405 Method Not Allowed Description: HTTP method not supported for this endpoint Cause: Using wrong HTTP method (e.g., DELETE on initSession) Solution: Use correct HTTP method:- GET: Retrieve data
- POST: Create items
- PUT/PATCH: Update items
- DELETE: Delete items
Input Errors
ERROR_BAD_ARRAY
HTTP Code: 400 Bad Request Description: Input must be an array of objects Cause: Invalid input format in request body Solution: Provide proper JSON format:ERROR_JSON_PAYLOAD_FORBIDDEN
HTTP Code: 400 Bad Request Description: GET requests cannot have a request body Cause: Sending JSON payload with GET request Solution: Use query parameters for GET requests:ERROR_JSON_PAYLOAD_INVALID
HTTP Code: 400 Bad Request Description: JSON payload is malformed Cause: Invalid JSON syntax Solution: Validate JSON before sending:Data Operation Errors
ERROR_GLPI_ADD
HTTP Code: 400 Bad Request Description: Failed to create item Possible Causes:- Missing required fields
- Invalid field values
- Foreign key constraints
- Duplicate unique fields
- Check ITSM-NG logs for specific error
- Verify all required fields are provided
- Validate field values and types
- Check entity permissions
ERROR_GLPI_PARTIAL_ADD
HTTP Code: 207 Multi-Status Description: Some items in batch creation failed Response includes: Array with success/failure status for each item Example Response:ERROR_GLPI_UPDATE
HTTP Code: 400 Bad Request Description: Failed to update item Possible Causes:- Item not found
- Invalid field values
- Locked item
- Missing required fields
- Verify item ID exists
- Check field values are valid
- Ensure item is not locked
- Review ITSM-NG logs
ERROR_GLPI_PARTIAL_UPDATE
HTTP Code: 207 Multi-Status Description: Some items in batch update failed Response includes: Array with success/failure status for each item Solution: Review response to identify which items failedERROR_GLPI_DELETE
HTTP Code: 400 Bad Request Description: Failed to delete item Possible Causes:- Item not found
- Item cannot be deleted (referenced elsewhere)
- Insufficient permissions
force_purge is needed:
ERROR_GLPI_PARTIAL_DELETE
HTTP Code: 207 Multi-Status Description: Some items in batch deletion failed Response includes: Array with success/failure status for each itemERROR_NOT_DELETED
HTTP Code: varies Description: Item must be moved to trash before purging Solution: Delete item first, then purge:Search & Query Errors
ERROR_SQL
HTTP Code: 500 Internal Server Error Description: SQL error occurred Cause: Database query failed Solution:- Check ITSM-NG logs in
files/_logs/ - Verify database connection
- Check for corrupted data
- Review search criteria syntax
ERROR_RANGE_EXCEED_TOTAL
HTTP Code: 400 Bad Request Description: Requested range exceeds available data Cause: Range start is greater than total count Example: Requestingrange=500-550 when only 200 items exist
Solution: Check total count first:
File Upload Errors
ERROR_UPLOAD_FILE_TOO_BIG_POST_MAX_SIZE
HTTP Code: 400 Bad Request Description: Uploaded file exceeds server limits Cause: File size exceedspost_max_size or upload_max_filesize in PHP configuration
Solution:
- Check current limits:
php -i | grep -E 'post_max_size|upload_max_filesize' - Increase in
php.ini: - Restart web server
- Or split large files into smaller chunks
Error Handling Best Practices
1. Always Check HTTP Status Codes
1. Always Check HTTP Status Codes
2. Implement Retry Logic
2. Implement Retry Logic
3. Log Errors Appropriately
3. Log Errors Appropriately
4. Handle Batch Operation Results
4. Handle Batch Operation Results
5. Validate Input Before Sending
5. Validate Input Before Sending
Complete Error Code Reference
| Error Code | HTTP | Description |
|---|---|---|
| ERROR_ITEM_NOT_FOUND | 404 | Resource not found |
| ERROR_BAD_ARRAY | 400 | Invalid input array |
| ERROR_METHOD_NOT_ALLOWED | 405 | HTTP method not allowed |
| ERROR_RIGHT_MISSING | 403 | Insufficient permissions |
| ERROR_SESSION_TOKEN_INVALID | 401 | Invalid session token |
| ERROR_SESSION_TOKEN_MISSING | 400 | Missing session token |
| ERROR_APP_TOKEN_PARAMETERS_MISSING | 400 | Missing app token |
| ERROR_WRONG_APP_TOKEN_PARAMETER | 400 | Invalid app token |
| ERROR_NOT_ALLOWED_IP | 400 | IP not authorized |
| ERROR_LOGIN_PARAMETERS_MISSING | 400 | Missing login parameters |
| ERROR_LOGIN_WITH_CREDENTIALS_DISABLED | 400 | Credential login disabled |
| ERROR_GLPI_LOGIN_USER_TOKEN | 401 | Invalid user token |
| ERROR_GLPI_LOGIN | 401 | Login failed |
| ERROR_RESOURCE_NOT_FOUND_NOR_COMMONDBTM | 400 | Invalid itemtype |
| ERROR_RESOURCE_MISSING | 400 | Missing resource |
| ERROR_SQL | 500 | SQL error |
| ERROR_RANGE_EXCEED_TOTAL | 400 | Range exceeds total |
| ERROR_GLPI_ADD | 400 | Create failed |
| ERROR_GLPI_PARTIAL_ADD | 207 | Partial create |
| ERROR_GLPI_UPDATE | 400 | Update failed |
| ERROR_GLPI_PARTIAL_UPDATE | 207 | Partial update |
| ERROR_GLPI_DELETE | 400 | Delete failed |
| ERROR_GLPI_PARTIAL_DELETE | 207 | Partial delete |
| ERROR_NOT_DELETED | varies | Item not in trash |
| ERROR_JSON_PAYLOAD_FORBIDDEN | 400 | GET with body |
| ERROR_JSON_PAYLOAD_INVALID | 400 | Invalid JSON |
| ERROR_UPLOAD_FILE_TOO_BIG_POST_MAX_SIZE | 400 | File too large |
Getting Help
If you encounter errors not covered here:- Check ITSM-NG Logs: Located in
files/_logs/ - Enable Debug Mode: Add
?debug=1or?debug=2to requests - Review SQL Logs: Enable SQL logging in debug mode
- Consult Documentation: Visit the inline API docs at
/apirest.php/ - Community Support: Check ITSM-NG forums and GitHub issues