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

How to add logic in apigee proxy to get kvm value based on input request

I have a requirement where I need to call external Oauth service using clientid and secret saved in kvm. In KVM Name field value is shipto number coming from request and Value field value is concatenation of client id, colon and secret. we have to put a logic in proxy : if shipto number in request matches with kvm name field value then corresponding client id and secret will be used to call external Oauth service to get the access token. Please suggest how to achieve this using Apigee proxy.

Solved Solved
2 7 382
1 ACCEPTED SOLUTION


@soumikghosh wrote:

do i need to decrypt the private variable first?


No.  the KVM Get decrypts the data and inserts it into your chosen variable. 

Now, regarding your attempt to use AssignMessage to split a string. ...

<AssignMessage name='AM-It-Would-be-Nice-if-This-were-a-real-feature'>
  <AssignVariable>
    <Name>secret</Name>
    <Value ref="kvm_value">
    <Pattern>^(.*?):(.*?)$</Pattern>
    <Group>2</Group>
    ...

Where did you get that syntax?  That's not a thing you can do with AssignMessage.  Did you just make that up, in hopes the policy would magically support it? Here is the documentation for the AssignMessage step type.  There is no support for Pattern or Group elements. There is no support for a ref attribute on the Value element.  Check the examples.

To split a string, use a JavaScript step.

View solution in original post

7 REPLIES 7
Top Solution Authors