curl --request POST \
--url https://api.example.com/api/urlValidator \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>"
}
'{
"success": true,
"isRecipe": true,
"error": {
"code": "<string>",
"message": "<string>"
}
}Validates a URL and checks if it contains recipe content
curl --request POST \
--url https://api.example.com/api/urlValidator \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>"
}
'{
"success": true,
"isRecipe": true,
"error": {
"code": "<string>",
"message": "<string>"
}
}curl -X POST https://yourdomain.com/api/urlValidator \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/recipe/chocolate-chip-cookies"
}'
{
"success": true,
"isRecipe": true
}
false for error responses.@type: "Recipe" in JSON-LD)| Error Code | Status | Description |
|---|---|---|
ERR_INVALID_URL | 200 | URL parameter is missing, not a string, or invalid format |
ERR_NO_RECIPE_FOUND | 200 | Page not found (404), empty content, or no recipe detected |
ERR_TIMEOUT | 200 | Request timed out after 10 seconds |
ERR_FETCH_FAILED | 200 | Network error or server error (5xx) |
ERR_UNKNOWN | 200 | Unexpected error occurred |
{
"success": false,
"error": {
"code": "ERR_INVALID_URL",
"message": "Please enter a valid URL"
}
}
{
"success": false,
"error": {
"code": "ERR_NO_RECIPE_FOUND",
"message": "No recipe found on this page"
}
}
{
"success": false,
"error": {
"code": "ERR_TIMEOUT",
"message": "Request timed out"
}
}
formatError utility