wordpress api using rest_route for other pages

Actually I was able to figure out with a little modification to Rank’s answer:

https://www.example.com/?rest_route=/wp/v2/posts&categories=12