About Errors

Check the errors returned in the API responses from Sourcehub.

Sourcehub APIs, when fired, can have either a successful response or a failure response. All successful Sourcehub API responses return with HTTP Status code 200. In case of failure, a JSON error response is returned with the relevant error parameters.

This error response helps to:

  • Map and analyze top failure reasons.
  • Identify the source of failure. It can be due to customer action or external factors.
  • Identify the exact failure reason. Display valid responses and provide meaningful next steps.

Error Structure

The error response contains parameters that help diagnose and solve the error.

Sample Error Response Code

In this sample code, see the indicating that the API failed due to authentication failure for incorrect token.
                    
                        {
                            "error": {
                                "code": "AUTHENTICATION_ERROR",
                                "description": "Invalid credential or token.",
                                "source": "https://webservices.sourcehub.in/api/products",
                                "status_code": 401
                            }
                        }
                    
                

Response Parameters

Parameter Data Type Description
error object The error object.
code string Type of the error.
description string Descriptive text about the error.
status_code Integer The HTTP status code.
Page Overview