Service Callout setup

I am making rest service call to a billing application.

From Postman, this is what i do

1. https://myurl/j_security_check?user=xyz&password=abc

2. https://myurl/restSecuritytoken This returns a Oauth2.0 token in the response header, which I copy to the header of the next call

3. https://myurl/svc/getInvoice

How can I set this up in apigee so that the calling application makes just 1 call.

1 1 161
1 REPLY 1

Not applicable

you have specified three calls and you want to make only one call. Let me explain as below.

1. create a proxy in apigee which will have the target as https://myurl/svc/getInvoice

2. assign a service callout in the proxy endpoint preflow, and call to https://myurl/j_security_check?user=xyz&password=abc by setting proper user and password information from the request.

3. if step two provides successful response then in another service callout make a call to https://myurl/restSecuritytoken

4. if step 3 provides a successful response then set the request header with the OAuth token header value received, using assign message policy.

5. now the actual request will go to the backend https://myurl/svc/getInvoice.