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

Requests for TestTrail


#1

Hello

I am trying to receive “id” for my milestone in Test Trial

I am doing request:

public String getMilestoneID(String milestoneID) throws Exception {
    String new_milestone_ID  = new URIBuilder()
            .setScheme(SCHEME)
            .setHost(HOST + "/" + Requests.isMilestoneID + "/" + milestoneID)
            .build().toString();
    String ID = parsingJSON(TestHTTPUtils.executeGetRequest(String.valueOf(new_milestone_ID)));
    return ID;

My request: https://testrail.a1qa.com/index.php?/api/v2/get_milestone/1

Parsing:
public static String parsingJSON(byte[] json) throws ParseException {
String input = new String(json);
JsonParser parser = new JsonParser();
JsonObject mainObject = (JsonObject) parser.parse(input);
JsonObject pItem = (JsonObject) mainObject.get(“id”);
return pItem.get(“id”).toString();

And for input - i have: {“error”:“Content-Type header missing (use Content-Type: application/json)”}

Could you help me, please