Common errors
This section provides a list of common errors you might encounter while using the JSON2Video API, along with potential causes and solutions. Understanding these errors can significantly speed up your debugging process.
Authentication Errors
-
401 Unauthorized
:- Cause: Invalid or missing API key in the
x-api-key
header. - Solution:
- Verify that you have included the
x-api-key
header in your request. - Double-check that the API key value is correct and matches the key in your JSON2Video dashboard.
- Ensure you're using the correct type of API key (Primary or Secondary) for the operation you're performing. Secondary API keys might not have sufficient permissions.
- Verify that you have included the
- Cause: Invalid or missing API key in the
JSON Payload Errors
-
400 Bad Request
: This is a general error indicating that something is wrong with your request. The error message in the response body will provide more details. Here are some common causes:-
Invalid JSON: The JSON payload is not properly formatted.
- Solution: Use a JSON validator to check your JSON for syntax errors (missing commas, unclosed brackets, etc.).
-
Missing Required Properties: The JSON payload is missing required properties according to the Movie JSON Schema.
- Solution: Refer to the schema documentation and ensure that all required properties are present and correctly named. For example, if using a
video
element, thesrc
property must be included, and thetype
property must be set to"video"
. The same applies for every element.
- Solution: Refer to the schema documentation and ensure that all required properties are present and correctly named. For example, if using a
-
Invalid Property Values: Properties have values that are not allowed or are of the wrong data type.
- Solution: Verify that property values conform to the expected data types (string, number, boolean, etc.) and that you are using allowed values (e.g., valid
resolution
values). Check the Movie JSON Schema for allowed values.
- Solution: Verify that property values conform to the expected data types (string, number, boolean, etc.) and that you are using allowed values (e.g., valid
-
Width and Height required when resolution is custom: When the movie
resolution
is set tocustom
, thewidth
andheight
are required.{ "resolution": "custom", "scenes": [...] }
Solution: The code snippet above will result in an error. You must include the
width
andheight
:{ "resolution": "custom", "width": 1920, "height": 1080, "scenes": [...] }
-