如何通过别名 header 传递电子邮件并获得特定回复?

How do I pass the email in alias header and obtain specific responses?

*新手放心

问题:
如何在别名 header 中传递电子邮件(GET 端点所需的用户电子邮件)并从响应中获取 session ID 和用户名 ID ?

详情: [GET] users/signin 端点需要用户电子邮件和 api 密钥。

卷曲:

curl -X GET "https://SomeWebSite.com/apiservice/users/signin?challengeMethod=EMAIL" -H "accept: application/json" -H "alias: usersignin@EXAMPLE.com" -H "X-API-KEY: d5a1d56d51d651d651d51d651d6d6d1"

响应:

{
"session": "ID inside of here",
"challengename": "CUSTOM_CHALLENGE",
"challengeSentTo": "usersignin@EXAMPLE.com",
"username": "5d654d6d65dd64d66adsb6a4"
}

我的代码:

public class AuthResponseTest {

    public static final String baseUri = "https://qa-mobile-app-auth-ext.clearcollateral.com/";
    public static final String basePath = "/apiservice/users ";

public String[] getSignIn() {

       return RestAssured
                .with()
                .log().all()
                .header("X-API-KEY", "API KEY IN HERE")
               .header("alias", "email here")
                .contentType(ContentType.JSON)
                .accept(ContentType.JSON)
                .baseUri(baseUri)
                .basePath(basePath)
               .when()
               .post("/users/signin")
               .then()
               .log().all()
               .statusCode(200)
       .extract().as(String[].class);
    }
    @Test
    public void testSignIn() {
        String[] authsignin =  getSignIn();
        System.out.println(authsignin);
    }
}

尝试一下;

.header("alias", "usersignin@EXAMPLE.com")