Errors
Image-Charts uses conventional HTTP response codes to indicate the success or failure of an API request. In general:
2xxsuccess status codes confirm that your request generated a chart4xxerror status codes indicate an error because of the information provided (e.g., a required parameter was omitted or specified with an unsupported format, etc.).5xxerror status codes are rare and indicate an error with Image-Charts's servers
Error HTTP responses can also contains error codes, some of them can be retried.
HTTP Status Code
200OK - The chart was generated as expected.400Bad Request - The request was unacceptable, often due to missing required parameter or malformed one. Check error code and error details for more information.401Unauthorized - No valid API key provided.403Forbidden - The API key doesn't have permissions to perform the request.429Too Many Requests - The request reach the limits, see error retries.500Server Errors - Something went wrong on Image-Charts's end. (These are very rare.)502Bad Gateway - Something went wrong on Image-Charts's end (rare case), see error retries.
Error codes
Some 4xx errors that could be handled programmatically (e.g., a parameter is malformed) include an error code in the x-ic-error-code HTTP header response parameter. Below is a list of possible error codes that can be returned, along with additional information about how to resolve them.
Regarding the error code an additional x-ic-error-validation http header parameter with further details is also sometimes included.
IC_INVALID_SIGNATURE: Invalid signature. Please check our documentation and code examplesIC_ACCOUNT_ID_NOT_FOUND: ACCOUNT_ID not found, you must be an Image-Charts subscriberIC_MISSING_ENT_PARAMETER: Theicac(ACCOUNT_ID) andichm(HMAC-SHA256 request signature) query parameters must both be defined if specified. Learn moreIC_RETINA_ERROR: The retina (high resolution image) feature is only available on Enterprise+ subscriptions. Please go to Image-Charts website to subscribe or contact our support to upgrade your subscription.IC_LOCALE_ERROR: Language localization feature is only available on Enterprise+ subscriptions. Contact our support to upgrade your account. Read more on our documentationIC_CHARTJS_RENDERING_ERROR: Image-Charts could not render Chart.js chartIC_UNAUTHORIZED_FONT_STYLE_ERROR: Font-style feature is only available on Enterprise+ subscriptionsIC_UNAUTHORIZED_FONT_FAMILY_ERROR: Font-family feature is only available on Enterprise+ subscriptionsIC_UNAUTHORIZED_STYLE_TITLE_ERROR: Stylize title with font-family and/or font-style is only available on Enterprise+ subscriptionsIC_UNAUTHORIZED_MULTI_AXIS_ERROR: Simple axis (chxt=x,y) are free forever. Multiple axis feature (chxt=x,x,y,y,t,t,r,r) is only available for Enterprise+ subscriptionsIC_UNAUTHORIZED_COMPOUND_CHART_ERROR: Compound charts (line markers) feature is only available on Enterprise+ subscriptionsIC_UNAUTHORIZED_BACKGROUND_IMAGE_CHART_ERROR: Background images are only available on Enterprise and Enterprise+ subscriptionsIS_VALIDATION_ERROR: There is one or more request parameters that are malformed. Check the associatedx-ic-error-validationresponse http header for details.IC_GRAPHVIZ_INVALID_SYNTAX: The GraphViz chart could not be generated because of invalid syntax. Check that the chl request parameter is valid.IC_GRAPHVIZ_ERROR: The GraphViz chart could not be generated due to internal GraphViz error.IC_GRAPHVIZ_MAX_EDGES_REACHED: The requested Graph has reached the maximum allowed number of edges (400). See GraphViz known limitations for more details.IC_GRAPHVIZ_MAX_NODES_REACHED: The requested Graph has reached the maximum allowed number of nodes (200). See GraphViz known limitations for more details.IC_QRCODE_TOO_MUCH_DATA: QRCode maximum data size exceededIC_BAD_JSON_ERROR: Value passed in query parameterchart(orc') must be a json, ES5 json or a base64 encoded jsonIC_BAD_BACKGROUND_COLOR_ERROR: Background color must be a valid rgba, rgb, hex or text colorIC_BAD_BACKGROUND_IMAGE_MAX_SIZE_REACHED_ERROR: Background image size is too big. It should not exceed1048576bytesIC_BAD_BACKGROUND_IMAGE_MAX_REDIRECTS_REACHED_ERROR: Could not download the image, max request redirects limit (2) reachedIC_BAD_BACKGROUND_IMAGE_MAX_TIMEOUT_REACHED_ERROR: Could not download the image, the request timeout is reached (2500ms)IC_BAD_BACKGROUND_IMAGE_COULD_BE_DOWNLOADED_ERROR: Could not download the image, an error related to DNS or Network occurredIC_BAD_DATA_FORMAT: .data attribute must contain a "datasets" attribute with a "data" array inside it. For instance:type: 'bar',
data: {
datasets: [{
data: [10, 20, 30, 40]
}]
}
}```IC_EMAIL_NOT_SENT: Could not send emailIC_SEND_EMAIL_MISSING: email attribute missing, could not sent emailIC_CONTACT_NOT_UPDATED: Could not update contactIC_METADATA_EMAIL_MISSING: email attribute missing, could not create or update metadataIC_UPDATE_METADATA_FAILED: Could not create or update MetadataIC_CUSTOMER_SEARCH_FAILED: Customer search failedIC_DATA_LOADING_FAILED: Data loading failed
Error handling
Your Image-Charts integration might have to deal with errors at some point when making requests to the Image-Charts API. These errors fall into three major categories:
- Content error -- Invalid content in the API request
- Network error -- Intermittent communication problems between client and server.
- Server error -- A problem on Image-Charts's servers.
Content Errors
Content errors are the result of the contents of an API request being invalid and return an HTTP response with a 4xx error code.
For example, the API servers might return a 401 if an invalid account_id or signature was provided, or a 400 if a required parameter was missing.
Integrations should correct the original request, and try again.
Depending on the type of user error (e.g., a malformed data parameter), it may be possible to handle the problem programmatically.
In these cases, include a code field to help an integration react appropriately. See error codes for more details.
Network Errors
Network errors are the result of connectivity problems between client and server and return low-level errors like socket or timeout exceptions. For example, a client might time out while trying to read from Image-Charts's servers, or an API response might never be received because a connection terminates prematurely. A network error wouldn't necessarily have otherwise been a successful request--it can also be another type of error that's been cloaked by an intermittent problem.
This class of errors is where the value of request retries is most obvious. When intermittent problems occur, clients are usually left in a state where they don't know whether or not the server received the request. To get a definitive answer, they should retry such requests with the same parameters until they're able to receive a result from the server.
Most client libraries can generate retry requests automatically, but need to be configured to do so. They perform their first retry quickly after the first failure, and subsequent retries on an exponential backoff schedule (see error retries for more details), the assumption being that a single failure is often a random occurrence, but a pattern of repeated failures likely represents a chronic problem.
Server Errors
Server errors are the result of a problem with Image-Charts's servers and return an HTTP response with a 5xx error code.
These errors are the most difficult to handle and we work to make them as rare as possible but integrations should be able to handle them when they do arise.
You should treat the result of a 500 request as indeterminate. The most likely time to observe one is during a production incident, and generally during such an incident's remediation. Image-Charts engineers will examine failed requests that result in 500s and fix them.
Error retries
Clients may retry on network errors, 429 and 502 http status code errors with exponential backoff. The minimum delay should be 1s.
When a client retry calls without waiting, it can produce a heavy load on the Image-Charts servers. Image-Charts infrastructure automatically limits IP that generate excessive load.
To avoid triggering these limits, you are strongly encouraged to implement truncated exponential backoff with introduced jitter.
Truncated exponential backoff is a standard error-handling strategy for network applications.
In this approach, a client periodically retries a failed request with increasing delays between requests.
Clients should use truncated exponential backoff for all requests to Image-Charts that return HTTP 502 and 429 response codes.