Skip to content

Errors

Wallpaper Server reports errors as plain-text response bodies with a standard HTTP status code. Responses are not JSON, and there are no stable machine-readable error codes. Check the status code, and treat the body as a human-readable message that may change.

StatusMeaningCommon causes
400 Bad RequestThe request was malformedInvalid wallpaper ID, missing file field on upload, an unsupported file extension
404 Not FoundNothing matchedNo wallpaper matches the given filters; unknown {id}; unknown route
405 Method Not AllowedWrong HTTP methodFor example POST to a GET-only endpoint
500 Internal Server ErrorThe server failed to complete the requestFilesystem or image-processing failure
503 Service UnavailableThe server cannot serve settingsThe configuration file path is not set
Invalid wallpaper ID
unsupported file extension: .gif
Missing 'file' field
Method not allowed

Because the body is plain text, branch on the status code rather than parsing the body. With curl, use --fail so a non-2xx response produces a non-zero exit code:

Terminal window
if curl --fail --silent \
"http://localhost:8519/api/wallpapers/random/image?brightness=dark" \
--output wallpaper.jpg; then
echo "Got a wallpaper"
else
echo "Request failed (no match or server error)"
fi

See Shell and cron for a safe download pattern that avoids overwriting a good wallpaper on failure.