OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse(
"application/json");
RequestBody body = RequestBody.create(mediaType,
"{\"personData\":{\"externalId\":\"1\",\"firstName\":\"Jane\",\"lastName\":\"Smith\",\"address\":\"67 Farringdon Road\",\"city\":\"London\",\"country\":\"United Kingdom\",\"gender\":\"FEMALE\",\"birthDate\":\"1966-01-15\",\"middleName\":\"Janie\",\"profilePicture\":\"http://profile.com\",\"tags\":[\"VIP Customers\",\"New Customers\"],\"customAttributes\":{\"Contract Expiry\":\"2018-06-01\",\"Company\":\"Acme\"},\"contactInformation\":{\"phone\":[{\"number\":\"41793026727\"},{\"number\":\"41793026728\"}],\"email\":[{\"address\":\"[email protected]\"},{\"address\":\"[email protected]\"}]}},\"flowVariables\":{\"orderDate\":\"2021-09-01\",\"orderDetails\":\"Extended Weight, Discount\",\"orderNumber\":1234567}}");
Request request = new Request.Builder()
.url(
"https://{baseUrl}/communication/1/flows/10159347/participants?phone&[email protected]&externalId=8edb24b5-0319-48cd-a1d9-1e8bc5d577ab&pushRegistrationId=8edb24b5-0319-48cd-a1d9-1e8bc5d577ab")
.method(
"POST", body)
.addHeader(
"Authorization",
"{authorization}")
.addHeader(
"Content-Type",
"application/json")
.addHeader(
"Accept",
"application/json")
.build();
Response response = client.newCall(request).execute();