Preheat the oven to 200°C (392°F) with top and bottom heat.
Peel the potatoes and cut them into large pieces. Peel the onions and cut them in half. Finely chop the garlic cloves. Season the chicken legs with salt, pepper, and thyme.
Mix the lemon juice, chopped garlic, olive oil, salt, and pepper together to make the marinade.
Place the chicken legs, potatoes, and onions in an ovenproof dish. Pour the marinade over everything and sprinkle with thyme.
Bake for 90 minutes at 200°C (392°F), basting the chicken and vegetables with the marinade every 30 minutes.
Check that the chicken has reached an internal temperature of 74°C (165°F) at the thickest part.
Sprinkle the chopped parsley over the dish before serving.