We chose GraphQL for the User Context Service because it offers significantly more flexibility for our integrations. The ability to define precisely the data you want—and only the data you want—is a powerful advantage over the REST API endpoints. GraphQL lets you replace multiple REST requests with a single call to fetch the data you specify.
For an in-depth understanding of GraphQL concepts and terminology, please refer to Interacting with GraphQL.
https://cpce-user-context-service.us-west-2.prodp.gcotechp.expedia.com/graphqlhttps://cpce-user-context-service-demo.us-west-2.test.gcotechp.expedia.com/graphqlYou can query and explore the User Context Service GraphQL schema definition.
User Context Service GraphQL Endpoint expects Authorization in headers for authenticating the incoming requests.
Please reach out to the Platform Team to get secrets for sandbox and production environment.
Once you have the secret, refer to the below sample to make a request.
POST {{ENDPOINT}}/graphql
Content-Type: application/json
Authorization: {{Secret}}
{ “query”: “query{retrieveUser(context:{ partnerId:\“39824e66-7eb1-4099-8110-ed41d7793f4d\“ businessSegmentId:\"4686b23c-3b0b-4abf-8baf-88da5b304cb5\" locale:""} identifier:{ identifierType:EMAIL identifierValue:\"abc@xyz.com\"}){userId}}” } The following sample GraphQL queries correspond to common scenarios for extracting user and booking data from the User Context Service.
Retrieve Booking details using Booking Identifiers
partnerId Partner GUID the Booking belongs to. Default value "".businessSegmentId Business Segment GUID the Booking belongs to. Default value "".locale Locale information to localize response content. Default value "".identifierType Type of the input Booking Identifier. Valid Values ORDERNUMBER POINTOFSALEORDERREFERENCENUMBER.identifierValue Booking Identifier Value.filterArgs.email if response needs to be filtered based on email associated with the booking.filterArgs.phone if response needs to be filtered based on phoneNumber associated with the booking.filterArgs.last4digitOfCc if response needs to be filtered based on whether any of the payment instrumentation for the
booking has used a credit card matching provided last 4 digits.query {
retrieveBooking(
context: {
partnerId: "bee71ae7-2a74-4d45-9817-c816784734e6"
businessSegmentId: "4686b23c-3b0b-4abf-8baf-88da5b304cb5"
locale: "en_US"
}
identifier: {
identifierType: POINTOFSALEORDERREFERENCENUMBER
identifierValue: "7552789044835"
}
) {
reservationUuid
bookedDateTime
bookedItems {
status
orderLineId
productType
}
tripStage
orderNumber
orderStatus
pointOfSaleOrderReferenceNumber
tripStage
tripStartDateTime
tripEndDateTime
stageOfTravel
bookingUpdateDateTime
}
}Retrieve Bookings using user identifiers
partnerId Partner GUID to define the scope of Bookings to be searched.businessSegmentId Business Segment GUID to define the scope of Bookings to be searched.locale Locale information to localize response content. Default value "".identifierType Type of the input User Identifier. Valid Values EMAIL PHONE ANI.identifierValue User Identifier Value.filterArgs.orderStatus if bookings need to be filtered based on status. Values BOOKED CANCELEDfilterArgs.stageOfTravel if bookings need to be filtered based on travel stage. Values COMPLETED NOT_COMPLETEDfilterArgs.last4digitOfCc if bookings need to be filtered based on whether any of the payment instrumentation for the
booking has used a credit card matching provided last 4 digits.filterArgs.tripToEndWindow if bookings need to be filtered based on number of days for trip to end.query {
retrieveBookings: retrieveBookings(
context: {
businessSegmentId: "a0c41f1d-1309-427a-a1eb-746dbb6d9cba"
partnerId: "33bea4ef-93c2-4166-b297-2b5e07b35235"
locale: "en_US"
}
identifier: {
identifierType: EMAIL
identifierValue: "kkaneta@expedia.com"
}
) {
bookedItems {
lodging {
checkInDate
}
air {
flightType
}
}
bookedDateTime
bookingUpdateDateTime
isPackage
orderNumber
orderStatus
tripStartDateTime
tripEndDateTime
tripStage
stageOfTravel
pointOfSaleOrderReferenceNumber
}
}Retrieve User details using User Identifiers
partnerId Partner GUID the Booking belongs to. Default value "".businessSegmentId Business Segment GUID the Booking belongs to. Default value "".locale Locale information to localize response content. Default value "".identifierType Type of the input Booking Identifier. Valid Values EMAIL CUSTOMERID PHONE.identifierValue Booking Identifier Value.query {
retrieveUser(
context: {
partnerId:"d8330dd6-a10b-49cc-a7ee-7217c2eb96b0",
locale:"en_US",
businessSegmentId:"0e9a4379-2497-42e0-9ba2-123aa59bd727"
},
identifier: {
identifierType: EMAIL,
identifierValue: "pgakhar@expediagroup.com"
}
) {
firstName
lastName
emailAddress
attributes
}