The one-time stay at the roadside in a car is generally okay as long as there exists no parking ban for the vehicle at that place. But you should be aware that it takes a certain amount of time to sleep in order to ensure the “restoration of physical ability to drive” as they say in Germany.