Selenium is for UI/browser automation. API testing should be done with REST Assured. In real projects, API automation is usually kept separate from Selenium UI automation for speed, stability and ...