Clarification on retrieving Service ID from Retrieve Referral Request (A005)

Hi all,

I’m trying to find a reliable way to retrieve the Service ID from the Retrieve Referral Request (A005) response.

From my testing so far, I’ve noticed the following behaviour:

  1. When the referral is active, the Service ID appears within the Appointment node.
  2. When the referral is cancelled, the Appointment node is no longer present.
  3. However, the Service ID appears within the Shortlist node, even in cases where the service was never explicitly shortlisted.

I wanted to check whether this behaviour is consistent across all referral states, or if there are scenarios where the Service ID might not be returned at all.

The reason this is important for us is that we still need to determine the Service ID for a referral even after it has been cancelled, in order to complete the corresponding workflow on our side.

Any clarification or guidance would be much appreciated.

Thanks in advance.

Hi @abhinav.bandi ,

Thanks for your question and welcome to the developer community.

The Service ID in the A005 response is dynamically resolved based on the state of the referral’s latest booking, and determines whether the Appointment node appears in the response. The Appointment node is included whenever a Service ID can be resolved, this is not directly tied to the referral state.

Service ID is resolved (Appointment node present) when:

  • Referral is booked - Service ID comes from the booking directly
  • Booking is cancelled but the shortlist unchanged - Service ID comes from original booking
  • Booking is cancelled after a redirect (e.g. Service A redirects to Service B, cancelling the original booking) - the original service (Service A) is returned via the shortlist’s redirected-from service ID
  • Deferral is unresolved - Service ID comes from the deferral
  • Deferral resolved with outcomes like CANCEL_APPOINTMENT_ADMIN_REBOOK, RETURN_TO_REFERRER, ADMIN_TO_REFER_LATER, or ACCEPT_REFER_BOOK_LATER - Service ID comes from the deferral

Service ID is not resolved (Appointment node absent) when:

  • The referral was never booked (no booking exists)
  • A booking was cancelled/DNA’d and then reshortlisted (new shortlist, not via a redirect)
  • A deferral was resolved with an outcome like REFER_BOOK_NOW

The Shortlist node

The Shortlist node is always present as long as the referral has a current shortlist, completely independently of whether a Service ID was resolved. This is why you’re seeing it even when the Appointment node is absent.

So if in your cancelled cases the Appointment node is missing, this likely means the referral was reshortlisted before or as part of the cancellation, causing the service resolution to fail.

A Note on Reliability

The Shortlist node is a more reliable fallback for retrieving the Service ID across states. Just be aware that if the referral was reshortlisted before cancellation, the current shortlist may contain a different service than the one originally booked.

If this is a concern and your workflow allows it, one option would be to call A005 at the point of booking (when the Appointment node is guaranteed to be present) and persist the Service ID on your side for later use. However, this depends on whether your integration is involved at that stage of the referral lifecycle.

Hope this helps,

Ed

2 Likes