How can I obtain the transfer function of an unknown circuit from its bode plot?
You have done all the right things, and you're nearly there, but for one conceptual thing.

If you drive your box with a low impedance source at Vin, and you sense the output with a high impedance device at Vout, then you cannot find the values of all three components, you can only find two ratios. You have a free choice of one component, then you can derive the other two as ratios to it.

Those two ratios is enough to find the transfer function, when placed between a zero and an infinite impedance.

You may object that if you choose 1ohm, or 1kohm for the resistor, doesn't this make a difference? It does make a difference to the amount of current the source has to provide. But you've drawn it as a voltage source, so it won't care what load it sees. Similarly no current is drawn from Vout. If the L and the C are the correct ratio to the resistor value, then the transfer function will be the same.

If you want to find values for all three components, then you have to use a finite impedance at one or both ports when you make the measurement. This provides a reference resistance value, then you can write equations for all three components with respect to this value. Unfortunately, as drawn, as the resistor R1 is in series with the voltage source V1, any source impedance added to V1 will be inseperable from R1, so a single measurement will not work. A shunt resistor across Vout will provide a unique solution, as will two measurements made with two different values of a resistor in series with V1.