{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Adapter for Envoy
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • 日本語コミュニティ
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • Product Announcements /
avatar image
0

AssignMessage - Simplifying your configuration and removing unnecessary AssignTo, etc  

  • Export to PDF
Dino-at-Google   created · Jul 01, 2020 at 05:22 PM · 58 Views

If you have this configuration

<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-SetPayload">
    <DisplayName>AM-SetPayload</DisplayName>
    <Properties/>
    <Set>
        <Payload contentType="application/json">
            {"user": {"id":"{jwt.Decode-JWT.decoded.claim.name}"}
        </Payload>
        <Verb>POST</Verb>
    </Set>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>

...you can simplify it. There's a bunch of stuff you don't need there. This is equivalent and is more easily readable, presents less stuff to understand .

<AssignMessage name="AM-SetPayload">
    <Set>
        <Payload contentType="application/json">
            {"user": {"id":"{jwt.Decode-JWT.decoded.claim.name}"}
        </Payload>
        <Verb>POST</Verb>
    </Set>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</AssignMessage>

Specifically regarding the "AssignTo" element... When you use this configuration:

<AssignTo createNew="false" transport="http" type="request"/>

...it doesn't do anything. If you have an empty AssignTo (there is no TEXT value for the element), then AssignMessage uses the ambient message, which is "message". It will be the request if you attach the policy in the request flow, and it will be the response if you attach the policy in the response flow. Just leave the AssignTo out, and the policy works fine. You mostly need that when creating a NEW message (createNew='true') and you want to name a variable to hold the message. That would look like this:

<AssignTo createNew="false" transport="http" type="request">myNewMessage</AssignTo>

But in general, most people are not doing that.

In Summary, Just keep the essential bits in your policy configuration, you'll be happier.

thub.nodes.view.add-new-comment
assign message policyassignmessage
Add comment
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Article

Contributors

avatar image

Follow this article

48 People are following this .

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Navigation

AssignMessage - Simplifying your configuration and removing unnecessary AssignTo, etc

Related Articles

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2021 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Adapter for Envoy
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • 日本語コミュニティ
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Badges