In most cases, you can find that information by looking up your bike's make and model and year on the manufacturer's website.
If that information is not available, check out our article, Everything You Need To Know About Rear Shocks, and see the section titled "How Do I Measure Rear Shock Hardware?"