Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Invalid number of path parameters. Expected 0, was 3" error while passing the url parameters in rest api (rest-assured)

Tags:

rest-assured

Trying to test the rest api with rest-assured. Getting the error

Invalid number of path parameters. Expected 0, was 3.

public class GetSociailDetails {

    @Test
    public void generateToken() {

        Map<String,String> userDetails = new HashMap<>();

        userDetails.put("msISDN", "1217071016");
        userDetails.put("messageSource", "TWITTER");
        userDetails.put("socialId", "168988132");

        given()
        .contentType("application/json")

        .pathParam("access_token", "LLRPqxvU1uoT8YSl8")

        .pathParam("pageNo", "1")

        .pathParam("order", "desc")

        .body(userDetails)

        .post("http://name.com/rest/crm/getdetails")

        .then()

        .statusCode(200);

    }

}

Is there a different way to pass the url params in the rest api which is of POST method.

like image 721
Nagarjuna Reddy Avatar asked Mar 11 '23 23:03

Nagarjuna Reddy


1 Answers

Instead of

.pathParam("pageNo", "1")

Changed to

.queryParam("pageNo", "1")

This worked.

like image 178
Nagarjuna Reddy Avatar answered May 11 '23 08:05

Nagarjuna Reddy