how to retrieve employee id from uri. In response payload some mandatory fields should be present

I have a requirement to retrieve employee id GET /employee/{employeeID}

Headers Accept - application/json or application/xml

Authorization - Bearer <Access Token>

Query params - none

Request Payload - none

Response Payload mandotory fields:

EmployeeID, firstName, Department

{ “EmployeeID“:”12345”, “firstname“:””, “lastname“:””, “DOB“:”DD-MM-YYYY”, “Department”:””,"JoiningDate:"DD-MM-YYYY"}

0 1 239
1 REPLY 1

@senk - Its not clear which employeeId you need to retrieve, the one in the request Path as a parameter or the one in the response payload?

Both can be done.

1. You can use the Extract Variables policy to retrieve the path parameter from the URI

2. You can use Extract variables policy to retrieve the EmployeeID element from the response json or JavaScript policy to extract it out.

You can check the samples provided in the docs -

https://docs.apigee.com/api-platform/reference/policies/extract-variables-policy