Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Constructing URL with query params in service callout

Not applicable

We're using Apigee to book appointments through a third-party API. I have a proxy endpoint (we'll call it "/appointment") that receives data: customer info (name, etc.), the appointment id, a reasonid, and a booking note. The first part is easy -- we send the customer info off to the external API and it returns a customer id. That works fine.

The next step is to call another target endpoint. The URL for that target takes the form <baseurl>/[appointmentid]?customer=[customerid]&reasonid=[reasonid]&bookingnote=[bookingnote]

The fields in square brackets, e.g., [appointmentid] are variables extracted from the initial request or, in the case of [customerid] from the response to the first target call.

In the PreFlow response for the initial request, I use an assign message to set the query parameters for the second proxy endpoint ("/schedule"), then have a service callout to that proxy endpoint.

I need the target url for the callout to reflect the format noted above, but if I put an ampersand in URL properties, I get an "invalid xml" message, and if I don't, the query parameters I'm setting in the assign message don't get into the outbound call.

Clearly, I'm missing something! Any help will be appreciated.

Solved Solved
1 4 6,391
1 ACCEPTED SOLUTION

@PPSNE

You can set the query parameters in the Service Callout policy itself. Please refer to "Define request line" tab under Samples section in the below link:

http://docs.apigee.com/api-services/reference/service-callout-policy

Regards,

Amar

View solution in original post

4 REPLIES 4