Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

Getting 404 error ("Unknown method")



I am new to TestRail and am trying to setup a simple connection between Selenium Web with Eclipse and TestRail using Java. When I run my code I am getting the error.

testrail.APIException: TestRail API returned HTTP 404("Unknown method 'test'")
at testrail.APIClient.sendRequest(
at testrail.APIClient.sendGet(
at test.test.main(

I am wondering what could be the issue. Below is the code:

import java.util.Arrays;
import testrail.APIClient;
import testrail.APIException;
import org.json.simple.JSONObject;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;

public class test {

public static void main(String[] args) throws InterruptedException, IOException 
  //Points to the browser driver
  System.setProperty("", "directory");
  //Cleans session and goes into incognito mode
  DesiredCapabilities cleanSession =;
  cleanSession.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true);
  cleanSession.setCapability("chrome.switches", Arrays.asList("--incognito"));
  APIClient client = new APIClient("");
  //Creates the browser driver that runs the automation. The driver is called CDriver
  ChromeDriver CDriver = new ChromeDriver();
  }catch (Exception e)

  try {
	JSONObject c = (JSONObject) client.sendGet("test/180254");
} catch (APIException e) {
	// TODO Auto-generated catch block



there is no API method called test

did you mean GET index.php?/api/v2/get_test/:test_id ?


I am still a bit confused on the process. I was looking at the examples in Do I need to include index.php for GET?


No - if you use the java bindings for example you only need to specify the actual method you need to call and the parameters.

Here is a code example from me, where I add a new case to TestRail

public String addCase(int sectionId, JSONObject data) throws IOException, APIException {
    JSONObject result = (JSONObject) client.sendPost("add_case/" + sectionId, data);
    return result.get("id");

the method is add_case and it requires the section where the case shall be added. In addition the post method requires the data which is send as a JSONObject.

As an example of a get method

  public String getSection(int sectionId) throws IOException, APIException {
    JSONObject get = (JSONObject) client.sendGet("get_section/" + sectionId);
    return String.valueOf(get.get("name"));

here the method is get_section and this also requires the sectionId as parameter. From the returned data I want the name

I hope this helps a bit - just ask if anything more is unclear