Need to assign a header variable from request to Json body

Hi ,

I have 2 header parameters from the request,

email and name - apigee.developer.email and apigee.developer.name

This value of email & name needs to be mapped to variables defined within jwt.claims

jwt.claims = {"sub": <apigee.developer.name>, "email": <apigee.developer.email>}

How do I map these headers params to "sub" and "email" in the above jwt.claims variable.

for ex: email = John.Doe@xxx.com and name = John Doe from the request

then., jwt.claims should be {"sub":"John Doe","email":"John.Doe@xxx.com"}

Could you please help?

0 1 272
1 REPLY 1

I'm not clear really on what you're asking.

I Think you want to assign a JSON value to a variable. This is easy with AssignMessage.

<AssignMessage name='AM-1'>
<AssignVariable> <Name>name_of_variable_to_set</Name> <Template>{ "sub" : "{request.header.subject}", "email" : "{Another_context_variable_here}" } </Template> </AssignVariable> </AssignMessage>

You can specify any variable name you like. You mentioned "jwt.claims" as a variable name but didn't mention anything about a JWT. So I'm not sure why it's important to set a variable with that particular name .

But anyway, that's your answer.