*New to Rest Assured
Question: How do I pass values provided from endpoint 'A' to endpoint 'B'?
My scenario: (using a UI api service that provides curls)
- [Endpoint 1] I provide a username in [GET] user/signin.
- I then get the follow response
{
"session": "Need to pass this session Id which changes everytime for every signin",
"challengeName": "CUSTOM_CHALLENGE",
"challengeSentTo": "example@EMAIL.com",
"username": "This id never changes"
}
- [Endpoint 2] I need to pass the session Id and username Id to the second endpoint which is a [GET] /user/verifyCode.
This endpoint requires the following:
1.The session id (string from endpoint 1)
2.username id (string from endpoint 1)
3.An api key
Curl for endpoint 2:
curl -X GET "https://example.com/apiservice/m1/users/verifyCode" -H "accept: application/json" -H "session: id from GET user/signin" -H "username: id from GET user/signin" -H "X-API-KEY: api key needed"
My Code for GET user/sign in (works for GET user/signin). Need to get this to work for Step 3
public void getInitialAuthSignIn() {
.given()
.header("X-API-KEY", "apiKey in here")
.queryParam("challengeMethod", "EMAIL")
.header("alias", "example@EMAIL.com")
.when()
.log().all()
.get(baseUri + basePath + "/users/signin");
}