Write a script in Python that calls an external REST API, parses the JSON payload, and logs specific error metrics.