To debug errors when communicating with IMI, observe
- the HTTP status in the response headers
- the messages and error codes in the response bodies.
You may use an HTTP proxy in order to see what requests your scripts or programs produce. A proxy acts as a man-in-the-middle between client and IMI, letting you view and optionally edit requests.
An Open Source program for this task is OWASP ZAP.