Come estrarre i dati api

Esempi di codice

0
0

come estrarre i dati api

We can use .extract then .jsonPath and lastly getString("token")

String myToken =
                
        given()
                .log().all()
                .contentType(ContentType.URLENC)
                .formParam("email","xxxxxxxxxxx")
                .formParam("password","xxxxxxx")
        .when()
                .post("/login")
        .then()
                .log().all()
                .statusCode(200)
                .body("token", is(notNullValue()))
                .contentType(ContentType.JSON)
                .body("token",is(not(emptyString())))
                .extract()
                .jsonPath()
                .getString("token")
        ;

In altre lingue

Questa pagina è in altre lingue

Русский
..................................................................................................................
English
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................